99 bottles of beer: Difference between revisions

Content added Content deleted
No edit summary
Line 1,776: Line 1,776:


=={{header|EGL}}==
=={{header|EGL}}==
<lang EGL>program BottlesOfBeer
<lang EGL>program TestProgram type BasicProgram {}
function main()
function main()
count int = 99;
beers string = bottleStr( count );
for (count int from 99 to 1 decrement by 1)
while ( count > 0 )
SysLib.writeStdout( bottleStr( count ) :: " of beer on the wall." );
SysLib.writeStdout( beers :: " of beer on the wall." );
SysLib.writeStdout( bottleStr( count ) :: " of beer." );
SysLib.writeStdout( beers :: " of beer." );
SysLib.writeStdout( "Take one down, pass it around." );
SysLib.writeStdout( "Take one down, pass it around." );
SysLib.writeStdout( bottleStr( count - 1) :: " of beer on the wall.\n");
count -= 1;
end
end
beers = bottleStr( count );
SysLib.writeStdout( beers :: " of beer on the wall.\n" );
private function bottleStr( count int in) returns( string )
end
case ( count )
end
when ( 1 )

return( "1 bottle" );
function bottleStr( count int ) returns( string )
case ( count )
when ( 0 )
when ( 1 )
return( "No more bottles" );
return( "1 bottle" );
otherwise
when ( 0 )
return( count :: " bottles" );
end
return( "No more bottles" );
otherwise
end
return( count :: " bottles" );
end
end
end</lang>
end</lang>