Processing Comparison

From Wiring

Jump to: navigation, search

Processing is an open source programming language and environment for people who want to program images, animation, and sound. It is used by students, artists, designers, architects, researchers, and hobbyists for learning, prototyping, and production.

The Wiring environment is written in C/C++ and the Processing environment is written in Java so there are many similarities between these two languages. Large distinctions occur with arrays declaration, loops syntax and the printing command. Wiring is used to create programs that run in the Wiring hardware. Processing is used to create programs that run on a PC.

Contents

Data

Wiring Processing
int x = 70; // Initialize

x = 30; // Change value

int x = 70; // Initialize

x = 30; // Change value

float x = 70.0;

x = 30.0;

float x = 70.0;

x = 30.0;

int[] a = {5, 10, 11}; // Create an array

a[0] = 12; // Reassign

int[] a = {5, 10, 11}; // Create an array
a[0] = 12; // Reassign

int a[8]; // Declare

a[0] = 1; // Initialize

int[] a = new int[8]; // Declare

a[0] = 1; // Initialize

int *a = new int[8]; // Declare

a[0] = 1; // Initialize

int[] a = new int[8]; // Declare
a[0] = 1; // Initialize

Control

Wiring Processing

void setup() {

  // Statements

}

void loop() {

  // Statements

}

void setup() {

  // Statements

}

void draw() {

  // Statements

}

for(int a=45; a<=55; a++) {
// Statements

}

for(int a=45; a<=55; a++) {
// Statements

}

if(c==1) {
// Statements

}

if(c==1) {
// Statements

}

if(c!=1) {
// Statements

}

if(c!=1) {
// Statements

}

if(c < 1) {
// Statements

}

if(c < 1) {
// Statements

}

if(c >= 1) {
// Statements

}

if(c >= 1) {
// Statements

}

if((c >= 1) && (c < 20)) {
// Statements

}

if((c >= 1) && (c < 20)) {
// Statements

}

if(c >= 20) {
// Statements 1

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

}

if(c >= 20) {
// Statements 1

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

Structure

Wiring Processing

// Comment

// Comment
void doIt(int x) {

  // Statements
}

doIt(x);

void doIt(int x) {

  // Statements
}

doIt(x);

int square(int x)

{
  return x*x;
}

square(X);

int square(int x)

{
  return x*x;
}

square(X);

Printing

Wiring Processing

Serial.println("hello world");

println("hello world");
int a = 55;

Serial.print(a, DEC);

int a = 55;

print(a);

int a = 55;

Serial.print("a is ");
Serial.print(a, DEC);

int a = 55;

print("a is " + a);

Personal tools