PascalABC.NET: Difference between revisions

Content deleted Content added
Fixed typos and comments alignment
Line 70:
In PascalABC.NET, functions are [[First-class citizen|first-class objects]]. They can be assigned to variables, passed as parameters, and returned from other functions. Functional type is set in the form <code>T -> Res</code>. An [[anonymous function]] can be assigned to the variable of this type:
<syntaxhighlight lang="delphi">
## // denotes that the main program will be written without enclosing bedinbegin-end
var f: real -> real := x -> x*x;
</syntaxhighlight>
Line 111:
 
begin
Down; // Prepareprepare turtle's pen
SetSpeed(11); // Setset turtle's movement speed
SetColor(Colors.Red); // Setset pen color
for var i:=1 to 450 do
begin
SetColor(RGB(128+i,0,i)); // Changechange pen color
Forw(i); // Movemove turtle forward
Turn(96); // Rotaterotate turtle clockwise
end;
end.
Line 145:
for var i:=a to b do
sum += i*i;
Print($'Sum = {sum}') // string interpolation
end.
</syntaxhighlight>