/////////////////////////////////// //If Statements / Conditionals ////////////////////////////////// //- If blocks //- Boolean Math & Operators /* if (condition1){ } else if(condition2){ println("boop") } else if( condition2 ){ println("solution to world hunger"); } else { } You can have small ones too if( condition ){ } //Works for 1 command with no braces{ } if( condition ) println("things"); Boolean Math Operators AND &&, OR ||, NOT ! Values TRUE FALSE AND T && T = T F && T = F T && F = F F && F = F OR T || T = T F || T = T T || F = T F || F = F NOT !T = F !F = T Examples 1 + 3 + 2 - 1 = 4 + 2 - 1 = 6 - 1 = 5 (T && F && T) || (F && T) = ( F ) || ( F ) = F T && T && F && T || T = F || T = T !(!(!(! T && F ) || !(T))) && F = F Example HitBox int px, py, pw, ph; int mx, my; //Hit box check if(mouseX > px && mouseX < px + pw && mouseY > py && mouseY < py + ph){ score++; } mouseX, mouseY are predefined values by Processing that store the value of the mouse coordinates */ int x, y; //Position of the ball int sx, sy; //Velocities of the ball int bw, bh; //Dimension of the ball void setup(){ size(400,400); //Set initial Values x = 100; y = 100; sx = 5; sy = 8; bw = 50; bh = 50; } void draw(){ //Clear the screen fill(255); rect(0,0,400,400); //Move the ball x = x + sx; //x += sx; y = y + sy; //y += sy; //Bounce off the sides fo the screens if(x < 0 || x > 400 - bw) sx *= -1; if(y < 0 || y > 400 - bh) sy *= -1; //Draw the ball fill(0,0,255); rect(x,y, bw, bh); } void mousePressed(){ if(bw > 0) bw *= 0.5; //Makes the ball half as big every click, because fun times! }