The Name Game: Difference between revisions
Content deleted Content added
m Added Dyalect lang |
|||
Line 742:
}
}</lang>
=={{header|Dyalect}}==
<lang dyalect>func printVerse(name) {
var x = name[..1].upper() + name[1..].lower();
var y =
if "AEIOU".indexOf(x[0]) > -1 {
x.lower()
} else {
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("Banana-fana fo-\(f)")
print("Fee-fi-mo-\(m)")
print("\(x)!", x)
print()
}
let seq = yields { "Gary", "Earl", "Billy", "Felix", "Mary", "Steve" }
for x in seq {
printVerse(x)
}</lang>
{{out}}
<pre>GAary, GAary, bo-bAary
Banana-fana fo-fAary
Fee-fi-mo-mAary
GAary!,GAary
EAarl, EAarl, bo-beaarl
Banana-fana fo-feaarl
Fee-fi-mo-meaarl
EAarl!,EAarl
BIilly, BIilly, bo-Iilly
Banana-fana fo-fIilly
Fee-fi-mo-mIilly
BIilly!,BIilly
FEelix, FEelix, bo-bEelix
Banana-fana fo-Eelix
Fee-fi-mo-mEelix
FEelix!,FEelix
MAary, MAary, bo-bAary
Banana-fana fo-fAary
Fee-fi-mo-Aary
MAary!,MAary
STteve, STteve, bo-bTteve
Banana-fana fo-fTteve
Fee-fi-mo-mTteve
STteve!,STteve</pre>
=={{header|F_Sharp|F#}}==
|