Turing Programming Language Article Index for
Turing
Shopping
Turing
Website Links For
Turing
 

Information About

Turing Programming Language




Turing is a Pascal -like Programming Language developed in 1982 by Ric Holt and James Cordy , then of University Of Toronto , Canada .

Turing is a descendant of . Versions for Unix , Microsoft Windows and Apple Macintosh are available.


HOW TO GET TURING


Most highschools - in Ontario, Canada - that offer some type of programming course would have a license. However, you may purchase your own license.


SYNTAX


Here is a sample Hello World program in Turing:

put "Hello World!"


VARIABLES


In order to create a variable, you must declare and define it.

Declaration:


var variable : int % This declares a numerical variable.

var variable : string % This declares a string.


Defining:

variable := ""


Or you can declare and define all at once:

var variable := ""



CODE SAMPLES


A brief example of Turing is the following Recursive function to calculate a Factorial .

% Accepts a number and calculates its factorial
function factorial (n: int) : real
if n = 0 then
result 1
else
  • factorial(n-1)

  • end if

end factorial

var n: int
loop
put "Please input an integer :" ..
get n
exit when n >= 0
put "Input must be a non-negative integer."
end loop
put "The factorial of ", n, " is ", factorial(n)

or

% Accepts the user's name and gender and outputs a greeting
var name, gender : string
put "Enter your last name: "
get name
cls
put "Are you Male(m) or Female(f)?"
get gender
cls
if gender = "m" then
put "Hello Mr. ", name, ", how are you?"
else
put "Hello Ms. ", name, ", how are you?"
end if


EXTERNAL LINKS




SEE ALSO