variables
N-dimentional arrays
loops
array
switch
strings
C++:
int led = 13; // implicit var declaration
bool ledState1 = false;
const float pi = 3.14;
#define c1 4 // const declaration
String s = "hello";
N-dimentional arrays
C++:
int b[ 2 ][ 2 ] = { { 1, 2 }, { 3, 4 } };
int b[ 2 ][ 2 ];
b[0][0] = 10;// item in array
loops
C++:
for(int i=0; i<7; i++) {}
while (someVariable < 200){}
do {}
while (someVariable ?? value);
array
C++:
// initialize an array:
int myInts[6];
int myPins[] = {2, 4, 8, 3, 6};
char message[6] = "hello";
myInts[0] = 10;// itemm in array
sizeof(arr); // returns arrray or list size
switch
C++:
switch (var) {
case 1:
//do something when var equals 1
break;
case 2,3:
// 2 or 3
break;
default:
// if nothing else matches, do the (optional) default
break;
}
strings
C++:
String stringThree = "I want ";
stringThree+=3; // string concate
Last edited: