Fibonacci numbers in Scratch
Example for versions
Scratch 1.4
This example uses recursive definition of Fibonacci numbers, since Scratch doesn’t have an easy way to define a function. Besides, Scratch is a graphical language, the print-screen contains the actual information about the program, source text is only a transcription.
set f1 to 1
set f2 to 1
set str to f1
repeat 15
set f3 to (f1 + f2)
set f1 to f2
set f2 to f3
set str to join (str (join (,) f1))
say join (str (...))
Fibonacci numbers example in Scratch
Comments
]]>blog comments powered by Disqus
]]>