Difference between revisions of "Processing"

From Wikicliki
Jump to: navigation, search
Line 3: Line 3:
 
== Self learning notes ==
 
== Self learning notes ==
  
* int - integer. they can be signed (neg and positive) or unsigned (all positive) values. unsigned values can hold larger values than signed values because the unsigned values have to have an extra bit in front to store whether the number is positive or negative.
+
* '''int''' - integer. they can be signed (neg and positive) or unsigned (all positive) values. unsigned values can hold larger values than signed values because the unsigned values have to have an extra bit in front to store whether the number is positive or negative.
* float - floating point numbers which have decimal place - used to approximate analog and continuous values
+
* '''float''' - floating point numbers which have decimal place - used to approximate analog and continuous values
* char - character or letters. but note that although you CAN add them, a+b wont equal ab or c or what you probly expect.
+
* '''char''' - character or letters. but note that although you CAN add them, a+b wont equal ab or c or what you probly expect.
* boolean - true/false values. in c++ its bool. true and false thusly are reserved words.
+
* '''boolean''' - true/false values. in c++ its bool. true and false thusly are reserved words.
* string - sequence of characters
+
* '''string''' - sequence of characters
* byte - datatype for bytes (8 bits of information storing numerical values) info that cant be stored by other strings or other numbers  
+
* '''byte''' - datatype for bytes (8 bits of information storing numerical values) info that cant be stored by other strings or other numbers  
* long - very large non-floating point numbers.
+
* '''long''' - very large non-floating point numbers.
  
  
* arrays:  
+
* '''arrays''':  
 
<pre>
 
<pre>
 
int[] numbers = new int[3];
 
int[] numbers = new int[3];
Line 25: Line 25:
 
</pre>
 
</pre>
  
 +
* '''casting''': to convert integer to float (decimal number). you cannot just make k (3) into 3.0 by making it float j = k. type cannot be just changed like that. cos 5 is not the same as 5.0, totally..... you can cast a char to a integer and back again. the only thing you cant cast is an array.
 +
<pre>
 +
int k = 3;
 +
float j = (float)k;
 +
// float is now 3.0 instead of 3
 +
</pre>
 +
 +
* basic operators (again!)
 +
<pre>
 +
+= adds value on the right of the value
 +
int height = 5;
 +
height += 1; // now its 6
 +
height += 20 // now its 26
 +
 +
-= subtracts value
 +
int width = 20;
 +
height -= 1; // now its 19
 +
height -= 10 // now its 9
  
 +
++ -- add minus
 +
int size = 2;
 +
size++; // now its 3
 +
size--; // now its 2
  
  
 
[[Category:Programming]]
 
[[Category:Programming]]

Revision as of 14:26, 9 April 2010

"Processing is an open source programming language and environment for people who want to program images, animation, and interactions."

Self learning notes

  • int - integer. they can be signed (neg and positive) or unsigned (all positive) values. unsigned values can hold larger values than signed values because the unsigned values have to have an extra bit in front to store whether the number is positive or negative.
  • float - floating point numbers which have decimal place - used to approximate analog and continuous values
  • char - character or letters. but note that although you CAN add them, a+b wont equal ab or c or what you probly expect.
  • boolean - true/false values. in c++ its bool. true and false thusly are reserved words.
  • string - sequence of characters
  • byte - datatype for bytes (8 bits of information storing numerical values) info that cant be stored by other strings or other numbers
  • long - very large non-floating point numbers.


  • arrays:
int[] numbers = new int[3];
numbers[0] = 122;
numbers[1] = 29;
numbers[2] = 10
// the name of the array is numbers. the square brackets is what indicates its an ARRAY

int arr[] = {1,2,3};
int arr[3] = {1,2,3};
// both these are fine, array does not need number length assigned
  • casting: to convert integer to float (decimal number). you cannot just make k (3) into 3.0 by making it float j = k. type cannot be just changed like that. cos 5 is not the same as 5.0, totally..... you can cast a char to a integer and back again. the only thing you cant cast is an array.
int k = 3;
float j = (float)k;
// float is now 3.0 instead of 3
  • basic operators (again!)
+= adds value on the right of the value
int height = 5;
height += 1; // now its 6
height += 20 // now its 26

-= subtracts value
int width = 20;
height -= 1; // now its 19
height -= 10 // now its 9

++ -- add minus
int size = 2;
size++; // now its 3
size--; // now its 2