Anonymous user
99 Bottles of Beer/Prolog: Difference between revisions
moving code from main task-page to sub-page / Visual Prolog
(moving code from main task-page to sub-page) |
(moving code from main task-page to sub-page / Visual Prolog) |
||
Line 44:
:- bottles(99).</lang>
=={{header|Visual Prolog}}==
<lang visual prolog>
implement main
open core, std, console
class predicates
bottles : (integer) -> string procedure (i).
clauses
bottles(1) = "bottle" :- !.
bottles(_) = "bottles".
run():-
init(),
foreach B = downTo(99,1) do
write(B," ",bottles(B), " of beer on the wall,\n"),
write(B," ",bottles(B), " of beer,\n"),
write("Take one down, pass it around,\n"),
write(B-1," ",bottles(B-1)," of beer on the wall.\n\n")
end foreach,
succeed().
end implement main
goal
mainExe::run(main::run).
</lang>
|