Professional Documents
Culture Documents
Declarations
const id [: dataType]:= initializing Value
var id{, id]: dataType [:= initializingValue]
Data types
int, real, string
Control Constructs
Any number of exit and exit when constructs can appear at any place inside
for .. end for constructs and loop .. end loop constructs.
LOOP loop
... statements ...
exit when expn
... statements ...
end loop
IF if condition then
... statements ...
{ elsif condition then
... statements ... }
[ else
... statements ... ]
end if
Graphics
maxx : int
Maximum value of x in current pixel graphics mode. For CGA, maxx = 319.
maxy : int
Maximum value of y in current pixel graphics mode. For CGA, maxy = 199
cls
Clears the screen and places cursor at point whose screen coordinates are (1, 1). In pixel
graphics mode, clears the screen and changes screen to current background color.
color (colorNumber: int)
Sets color for text to be displayed.
colorback (colorNumber: int)
Sets color of the background on which text is to be displayed.
colorback (colorNumber : int)
Sets current background color of text displayed. The default background color is white.
drawdot (x, y, color : int)
Sets a dot (pixel) of color at point (x, y).
drawline (x1, y1, x2, y2, color : int)
Draws a line in color from (x1, y1) to (x2, y2).
drawbox (x1, y1, x2, y2, color : int)
Draws a rectangle in color with sides parallel to the axes, bottom left corner at (x1, y1), and
upper right corner at (x2, y2).
drawfillbox (x1, y1, x2, y2, color : int)
Draws a filled in rectangle in color with sides parallel to the axes, bottom left corner at (x1,
y1), and upper right corner at (x2, y2).
drawoval (xCenter, yCenter, xRadius, yRadius, color : int)
Draws an oval in color with center at (xCenter, yCenter), horizontal distance to oval xRadius,
vertical distance yRadius.
drawfilloval (xCenter, yCenter, xRadius, yRadius, color : int)
Draws a filled in oval in color with center at (xCenter, yCenter), horizontal distance to oval
xRadius, vertical distance yRadius.
drawarc (xCenter, yCenter, xRadius, yRadius : int, initialAngle, finalAngle, color : int)
Draws a part of an oval whose specifications are given (as in drawoval) between two lines
from the center that make angles in degrees: initialAngle and finalAngle , as measured
counterclockwise from the three o’clock position as zero.
drawfillarc (xCenter, yCenter, xRadius, yRadius : int, initialAngle, finalAngle, color : int)
Draws a filled-in “piece of pie” shaped wedge whose specifications are given (as in drawoval)
between two lines from the center that make angles in degrees: initialAngle and finalAngle, as
measured counterclockwise from the three o’clock position as zero.
drawfill (xInside, yInside, fillColor, borderColor : int)
Starting from a point (xInside, yInside ) fills an area surrounded by borderColor with
fillColor
locatexy (x, y : int)
Changes the cursor position in pixel graphics (the cursor is not visible) to be in the nearest
character position to point (x, y).
delay (duration : int)
Causes a delay of length duration milliseconds. A delay of duration 500 is half a second.
Operators
This is a list of the operators available in Turing and their precedence.
Mathematical Operators
Operator Operation Result Data Type
+ Addition Same as Operands
– Subtraction Same as Operands
* Multiplication Same as Operands
/ Division Same as Operands
div Integer Division int
mod Modulo int
** Exponentiation Same as Operands
< Less Than boolean
> Greater Than boolean
= Equals boolean
<= Less Than or Equal boolean
>= Greater Than or Equal boolean
not= Not Equal boolean
Boolean Operators
Prefix not Negation boolean
and And boolean
or Or boolean