Turing (Iamcalledbob)
Jump to navigation
Jump to search
Syntax
Turing is designed to have a very lightweight, readable, intuitive syntax. Here is the entire Hello World! program in Turing with syntax highlighting:
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()