Factorial in Scratch

Example for versions Scratch 1.4

Since Scratch is a graphical language, the print-screen contains the actual information about the program, source text is only a transcription.

strs is a vector-style array. delete all block is required to clean it before running program again. repeat is a kind of loop which repeats its body for exactly the given number of times. join is a block which concatenates its arguments. hide hides the avatar (to clean the stage).

Scratch doesn’t have a standard output as such, neither has it a possibility of “saying” multi-line things. An array was used to output the example results in the required form.

delete all of strs
set i to 0
set f to 1
repeat 17
   add (join i (join (! = ) f)) to strs
   set i to (i + 1)
   set f to (f * i)
hide

Factorial example in Scratch
Factorial example in Scratch