Artifact 8920e9fd1d3980816af06629a7da5aecca52ecb2
- File
sample/fizzbuzz.pmy
- 2010-11-24 12:14:00 - part of checkin [3ae09b8cbf] on branch trunk - changed if-then-else syntax (user: kinaba) [annotate]
# # Not at all a good example of the usage of layers, but anyway... # @@3(x){x}; @@5(x){x}; @@15(x){x}; def incr(x) { x+1 }; @ 3 incr(x) {@value( if(@ 3(x)+1< 3)then@ 3(x)+1 else 0 )}; @ 5 incr(x) {@value( if(@ 5(x)+1< 5)then@ 5(x)+1 else 0 )}; @15 incr(x) {@value( if(@15(x)+1<15)then@15(x)+1 else 0 )}; def fb(n @value @3 @5 @15) { print( if @15(n): if @5(n): if @3(n): n else: "Fizz" else "Buzz" else "FizzBuzz" ); fb(incr(n)) }; fb(0)