The Name Game: Difference between revisions
Content deleted Content added
m finshed haskell source |
Added Julia language |
||
Line 465: | Line 465: | ||
Fee-fi-mo-mteve |
Fee-fi-mo-mteve |
||
Steve!</pre> |
Steve!</pre> |
||
=={{header|Julia}}== |
|||
<lang julia>import Compat: uppercasefirst |
|||
import Compat: uppercasefirst |
|||
function printverse(name::AbstractString) |
|||
X = uppercasefirst(lowercase(name)) |
|||
Y = X[1] ∈ ('A', 'E', 'I', 'O', 'U') ? X : SubString(X, 2) |
|||
b = X[1] == 'B' ? "" : "b" |
|||
f = X[1] == 'F' ? "" : "f" |
|||
m = X[1] == 'M' ? "" : "m" |
|||
println("""\ |
|||
$(X), $(X), bo-$b$(Y) |
|||
Banana-fana fo-$f$(Y) |
|||
Fee-fi-mo-$m$(Y) |
|||
$(X)! |
|||
""") |
|||
return nothing |
|||
end |
|||
foreach(TheNameGame.printverse, ("gARY", "Earl", "Billy", "Felix", "Mary", "sHIRley"))</lang> |
|||
{{out}} |
|||
<pre>Gary, Gary, bo-bary |
|||
Banana-fana fo-fary |
|||
Fee-fi-mo-mary |
|||
Gary! |
|||
Earl, Earl, bo-bEarl |
|||
Banana-fana fo-fEarl |
|||
Fee-fi-mo-mEarl |
|||
Earl! |
|||
Billy, Billy, bo-illy |
|||
Banana-fana fo-filly |
|||
Fee-fi-mo-milly |
|||
Billy! |
|||
Felix, Felix, bo-belix |
|||
Banana-fana fo-elix |
|||
Fee-fi-mo-melix |
|||
Felix! |
|||
Mary, Mary, bo-bary |
|||
Banana-fana fo-fary |
|||
Fee-fi-mo-ary |
|||
Mary! |
|||
Shirley, Shirley, bo-bhirley |
|||
Banana-fana fo-fhirley |
|||
Fee-fi-mo-mhirley |
|||
Shirley!</pre> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |