The Name Game: Difference between revisions
Content added Content deleted
m (Added Dyalect lang) |
|||
Line 746: | Line 746: | ||
<lang dyalect>func printVerse(name) { |
<lang dyalect>func printVerse(name) { |
||
let x = name[..1].upper() + name[1..].lower(); |
|||
let y = "AEIOU".indexOf(x[0]) > -1 ? x.lower() : x[1..] |
|||
var y = |
|||
let b = x[0] is 'B' ? y : "b" + y |
|||
let f = x[0] is 'F' ? y : "f" + y |
|||
let m = x[0] is 'M' ? y : "m" + y |
|||
x[1..] |
|||
} |
|||
var b = "b" + y |
|||
var f = "f" + y |
|||
var m = "m" + y |
|||
match x[0] { |
|||
'B' => b = y, |
|||
'F' => f = y, |
|||
'M' => m = y, |
|||
_ => { } //ignore |
|||
} |
|||
print("\(x), \(x), bo-\(b)") |
print("\(x), \(x), bo-\(b)") |
||
print("Banana-fana fo-\(f)") |
print("Banana-fana fo-\(f)") |
||
Line 769: | Line 758: | ||
print() |
print() |
||
} |
} |
||
let seq = yields { "Gary", "Earl", "Billy", "Felix", "Mary", "Steve" } |
let seq = yields { "Gary", "Earl", "Billy", "Felix", "Mary", "Steve" } |
||
for x in seq { |
for x in seq { |
||
printVerse(x) |
printVerse(x) |