Conditions and Logic

All logical operators
  • == equal to
  • != not equal to
  • > greater than
  • < less than
  • >= greater than or equal to
  • <= less than or equal to

IF statement syntax

if (condition) {
	code
} else if (condition) {
	code
} else {
	code
}

//single line if statment
num1 > num2? num1 : num2
condition  | true | false |

Switch case statement syntax

switch(value)
{
	case value1:
		code
		break;

	default:
		code
		break;
}

Note: that all values must be one of the following (int, char, short, long, long long, or enum).

Logical operators