Comparing NXT-G, NXC, Python-Turtle, and Scratch
Basic Movement Commands for Turtle and Robotics

NXT-G
NXC
Python-Turtle
Scratch
Basic Forward (Motor A)

OnFwd(OUT_A, 75);
forward()

Basic Stop (Motors B and C)

Off(OUT_BC);
No Python Version
No Scratch Version
Forward a set distance
of one motor rotation

RotateMotor(OUT_BC, 75, 360);
forward(100)
Swing Turn Left

RotateMotor(OUT_B, 75, 360);
left(90)

Swing Turn Right

RotateMotor(OUT_C, 75, 360);
right(90)

Point Turn Right

RotateMotorEx(OUT_BC, 75, 360, 100);

Repeat

repeat(4)
{
Task;
}
for i in range(4):
Task

Infinite Loop

while(true)
{
Task;
}
while True:

If Statement

 if(condition)     {         Task;     }

-or-

 do     {         Task;     } while(condition)

if condition:
Task

If Else

if(condition)
{
Task;
}
else
{
Another Task;
}
if condition:
Task
else:
Another Task

Comments

// Put Comments after slashes
# Put Comments Here
No Comment Function in Scratch
Defining Functions

task Draw_Square()
def Draw_Square():
When I Receive DrawSquare
Sample Program
(Move in a Square or Draw a Square)

// This Program Draws a Square
// in NXC

task main()
{
repeat(4)
{
RotateMotor(OUT_BC, 75, 1440);
RotateMotor(OUT_B, 75, 360);
}
}

# This Program Draws
# a Square in Python

from turtle import *

for i in range(4):
forward(100)
right(90)