The Name Game: Difference between revisions
Content added Content deleted
Line 822: | Line 822: | ||
Fee-fi-mo-mteve |
Fee-fi-mo-mteve |
||
Steve! |
Steve! |
||
</pre> |
|||
=={{header|Phix}}== |
|||
{{trans|Go}} |
|||
<lang Phix>constant fmt = """ |
|||
%s, %s, bo-%s |
|||
Banana-fana fo-%s |
|||
Fee-fi-mo-%s |
|||
%s! |
|||
""" |
|||
procedure printVerse(string name) |
|||
string x = lower(name) |
|||
integer x1 = upper(x[1]), |
|||
vowel = find(x1,"AEIUO")!=0 |
|||
string y = x[2-vowel..$], |
|||
b = 'b'&y, f = 'f'&y, m = 'm'&y |
|||
x[1] = x1 |
|||
switch x1 do |
|||
case 'B': b = y |
|||
case 'F': f = y |
|||
case 'M': m = y |
|||
end switch |
|||
printf(1,fmt,{x, x, b, f, m, x}) |
|||
end procedure |
|||
constant tests = {"gARY", "Earl", "Billy", "Felix", "Mary", "SHIRley"} |
|||
for i=1 to length(tests) do printVerse(tests[i]) end for</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> |
</pre> |
||