Fibonacci numbers in FALSE
Example for versions
Morphett's FALSE,
Wouter's FALSE 1.2.CF
This example uses iterative method of calculating Fibonacci numbers. Variables a
and b
store current numbers, variable i
is loop counter.
The second loop empties the stack (deletes Fibonacci numbers written there by the first loop). Some interpreters tolerate data left in stack after program completion, but Wouter’s FALSE requires that the stack is empty and throws a runtime error otherwise.
0i: 1a: 1b:
[i;16=~]
[a; $. ", " $ b; $ a: + b: i;1+i:]
#
"..."
[1=~]
[]
#
%
Comments
]]>blog comments powered by Disqus
]]>