Language \ Environment \ Comparison
 
  The Processing Language (API) is based on Java. It is therefore easy to see similarities between Processing and ActionScript. Languages such as Python and Design By Numbers offer interesting comparisons.

Color
Shape
Image
Data
Control
Structure
Input
 
       
  Processing Python ActionScript Lingo Design By Numbers
  background(0);
background(255);
N/A N/A the stageColor = 255
the stageColor = 0
Paper 100
Paper 0
  background(255, 204, 0); N/A N/A (the stage).bgcolor = rgb(255,204,0) N/A
  stroke(255);
stroke(0);
N/A lineStyle(x,0xFFFFFF,a)
lineStyle(x,0x000000,a)
(the stage).image.draw(x1,y1,x2,y2, 0)
(the stage).image.draw(x1,y1,x2,y2, 255)
Pen 0
Pen 100
  stroke(255, 204, 0); N/A lineStyle(x,0xFFCC00,a) (the stage).image.draw(x1,y1,x2,y2, rgb(255,204,0)) N/A
  fill(0, 102, 153); N/A beginFill (0x006699, alpha);
beginGradientFill(filltype, colors[], alphas, ratios, matrix);
(the stage).image.fill(left, top, right, bottom, rgb(0,102,153)) N/A
           

       
  Processing Python ActionScript Lingo Design By Numbers
  point(30, 20); N/A moveTo(x1,y1);
lineTo(x1,y1);
(the stage).image.setPixel(30,20,rgb(0,120,153)) Set [30 20] 0
  line(0, 20, 80, 20); N/A moveTo(x1,y1);
lineTo(x2,y2);
(the stage).image.draw(0, 20, 80, 20, [#shapeType:#line]) Line 0 20 80 20
  rect(10, 20, 30, 30);
N/A moveTo(10,20);
lineTo(30,20);
lineTo(30,30);
lineTo(10,30);
(the stage).image.fill(10,20,30,30, [#shapeType:#rect])
(the stage).image.draw(10,20,30,30, [#shapeType:#rect])
Field 0 20 40 50 100
           

       
  Processing Python ActionScript Lingo Design By Numbers
  setPixel(30, 20, 255); N/A N/A (the stage).image.setPixel(30,20,rgb(0,120,153)) Set [30 20] 100
  a = getPixel(60, 10); N/A N/A a = (the stage).image.getPixel(60,10) Set a [60 10]
  pixels[y*width+x] N/A N/A N/A [x y]
           

       
  Processing Python ActionScript Lingo Design By Numbers
  int x = 70;  // Initialize
x = 30;  // Change value
x = 70  # Initialize
x = 30  # Change value
var x = 70;  // Initialize
x = 30;  // Change value
x = 70  -- Initialize
x = 30  -- Change value
Set X 70  // Initialize
Set X 30  // Change value
  float x = 70.0;  
x = 30.0;
x = 70.0
x = 30.0
var x = 70.0;
x = 30.0;
x = 70.0  -- Initialize
x = 30.0  -- Change value
N/A
  int[] a = {5, 10, 11};

a[0] = 12;  // Reassign
a = (5, 10, 11)

a[0] = 12  # Reassign
a = new Array{5,10,11};

a[0] = 12;  // Reassign
a = [5,10,11]

a[0] = 12  -- Reassign
set <array 1> 5
set <array 2> 10
set <array 3> 11

set <array 1> 12  // Reassign
           

       
  Processing Python ActionScript Lingo Design By Numbers
  void loop() {
  // Statements
}
while 1:
  # Statements
do {
  // Statements
}
repeat while TRUE
-- Statements
end repeat
Forever
{
  // Statements
}
  for(int a=45; a<=55; a++) {
  // Statements
}
for a in range(45, 55):
  # Statements
for(a=45; a<=55; a++) {
  // Statements
}
repeat with a = 45 to 55
   -- Statements
end repeat
Repeat A 45 55
{
  // Statements
}
  if(c==1) {
  // Statements
}
if c == 1:
  # Statements
if(c==1) {
  // Statements
}
if c = 1 then
   -- Statements
end if
Same? C 1
{
  // Statements
}
  if(c!=1) {
  // Statements
}
if c != 1:
  # Statements
if(c!=1) {
  // Statements
}
if not(c = 1) then
   -- Statements
end if
NotSame? C 1
{
  // Statements
}
  if(c < 1) {
  // Statements
}
if c < 1:
  # Statements
if(c < 1) {
  // Statements
}
if c < 1 then
   -- Statements
end if
Smaller? C 1
{
  // Statements
}
  if(c >= 1) {
  // Statements
}
if c >= 1:
  # Statements
if(c >= 1) {
  // Statements
}
if c >= 1 then
   -- Statements
end if
NotSmaller? C 1
{
  // Statements
}
  if((c >= 1) && (c < 20)) {
  // Statements
}
if c >= 1 and c < 20:
  # Statements
if((c >= 1) && (c < 20)) {
  // Statements
}
if c >= 1 and c < 20 then
   -- Statements
end if
NotSmaller? C 1
{
  Smaller? C 20
  {
    // Statements
  }
}
 

if(c >= 20) {
  // Statements 1
} else if (c == 0) {
  // Statements 2
} else {
  // Statements 3
}

if c >= 20:
  # Statements
elif x == 0:
  # Statements
else:
  # Statements
if(c >= 20) {
  // Statements 1
} else if (c == 0) {
  // Statements 2
} else {
  // Statements 3
}
if c >= 20 then
   -- Statements 1
else if c = 0 then
   -- Statements 2
else
   -- Statements 3
end if
N/A
           

       
  Processing Python ActionScript Lingo Design By Numbers
  // Comment # Comment // Comment -- Comment // Comment
  void doIt(int x) {
  // Statements
}

doIt(x);
def doIt(x):
  # Statements

doit(x)
function doIt(int x) {
  // Statements
}

doIt(x);
on doIt x
   -- Statements
end

doIt x
Command doIt X
{
  // Statements
}

<doIt X>
  int square(int x)
{
  return x*x;
}

square(X);
def square(x):
  return x*x

square(x)
function square(int x)
{
  return x*x;
}

square(x);
on square x
   return x*x
end

put square(x)
Number Square X
{
   value (x*x)
}

<square X>
           

       
  Processing Python ActionScript Lingo Design By Numbers
  mouseX
mouseY
mousePressed
N/A _Xmouse
_Ymouse
N/A
the mouseH
the mouseV
mouseDown()
<Mouse 1>
<Mouse 2>
<Mouse 3>
  void mousePressed() {
  // Statements
}
N/A mice = new Object();
mice.onMouseDown =
function() {
  // Statements
}
on mouseDown
   -- Statements
end if
N/A
  (key=='a') 
(key=='b') 
...
N/A (chr(key.getAscii()) == 'a')
(chr(key.getAscii()) == 'b')
...
(the key = "a")
(the key = "b")
<Key 1>
<Key 2>
...
  void keyPressed() {
  // Statements
}
N/A key = new Object();
key.onKeyDown =
function() {
  // Statements
}
on keyDown
   -- Statements
end
N/A
  hour()
minute()
second()
N/A now = new Date();
now.getHours()
now.getMinutes()
now.getSeconds()
currentTime = the long time
hour = value(chars(currentTime,1,2))
minute = value(chars(currentTime,4,5))
hour =value(chars(currentTime,7,8))
<Time 1>
<Time 2>
<Time 3>
           
Processing / Python by REAS, Walter Aprile
Processing / Lingo by Victor Vina, Josh Nimoy
Processing / ActionScript by JimQode, Martin, XemonerdX, Dara
Processing / Design By Numbers by Josh Nimoy
   
© 2002, 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas