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)
{
}
for i in range(4):

Infinite Loop

while(true)
{
}
while True:

If Statement

-or-

if condition:

If Else

if(condition)
{
}
else
{
}
if condition:
else:

No Comment Function in Scratch
Defining Functions

def Draw_Square():
Sample Program
(Move in a Square or Draw a Square)

// This Program Draws a Square
// in NXC

{
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)