Language OPS5
(This is first OPS5 example!)
Date: | 10/28/09 |
Author: | Scott Hamilton |
URL: | n/a |
Comments: | 0 |
Info: | http://en.wikipedia.org/wiki/OPS5 |
Score: | ![]() |
; The Beer Song in OPS5 ; ; Author: S.Hamilton ; Version: V1.0 ; ; Abstract: ; I don't have access to a OPS5 compiler any more, so this is coding ; from my memory. so if someone can compile it and update any logic/syntax ; errors. ; (literalise Count bottles) (literalise SecondLine) (startup (make Count ^bottles 99) ) (p moreBeer (Count ^bottles {<beerLeft> > 0}) -(SecondLine) --> (writeln <beerLeft>| bottle of beer on the wall, | <beerLeft> | bottle of beer.|) (modify 1 ^bottles (compute <beerLeft>-1)) (make SecondLine) ) (p moreBeerSecondLine (Count ^bottles > 1 ) (SecondLine) --> (writeln |Take one down and pass it around, | <beerLeft> | bottles of beer on the wall.|) (remove 2) ) (p oneMoreBeerSecondLine (Count ^bottles 1) (SecondLine) --> (writeln |Take one down and pass it around, | <beerLeft> | bottle of beer on the wall.|) (remove 2) ) (p lastBeerSecondLine (Count ^bottles 0) (SecondLine) --> (writeln |Take one down and pass it around, no more bottles of beer on the wall.|) (remove 2) ) (p noMoreBeer (Count ^bottles 0) -(SecondLine) --> (writeln |No more bottles of beer on the wall, no more bottles of beer.|)) (writeln |Go to the store and buy some more, 99 bottles of beer on the wall.|) (remove 1) )
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments