Jump to navigation Jump to search
put "Hello World!"
Turing avoids semicolons and braces, using implicit end markers for most language constructs instead, and allows declarations anywhere. Here is a complete program defining and using the traditional recursive function to calculate a factorial.
% Accepts a number and calculates its factorial fun factorial (n) if n = 0 result 1 else result n * factorial (n - 1) fun loop() get n if n < 0 put "The factorial of ", n, " is ", factorial (n) result n else result loop() loop()