Example Name Game

ASnake Documentation

Table Of Contents

    Only children would find this code useful.

    Code:

    nameGame does
        if name to len < 2
            name is "Dumb"
    
        name is name.capitalize()
        if name[0] in 'AEIOU'
            cutName is name.lower()
        else cutName is name[1:]
    
        b=f'b{cutName}' ; f=f'f{cutName}' ; m=f'm{cutName}' 
        match name[0]
        of 'B' then b is cutName
        of 'F' then f is cutName
        of 'M' then m is cutName
    
        f'{name}, {name}, bo-{b}'
        f'Banana-fana fo-{f}'
        f'Fee-fi-mo-{m}'
        f'{name}!'
    from name
    
    names ['Gary', 'Earl', 'Billy', 'Felix', 'Mary','po','x']
    loop names name
        name to nameGame
    

    Result:

    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!
    Po, Po, bo-bo
    Banana-fana fo-fo
    Fee-fi-mo-mo
    Po!
    Dumb, Dumb, bo-bumb
    Banana-fana fo-fumb
    Fee-fi-mo-mumb
    Dumb!
    
    Scroll to top