- starting from main
- from top to down
- from right to left
- from inside to outside
- NOR
a | result nor a -> !a
0 1
1 0
- OR
a | b | result a or b -> ||
0 0 0
0 1 1
1 0 1
1 1 1
- AND
a | b | result a and b -> &&
0 0 0
0 1 0
1 0 0
1 1 1
-
Regarding if,else if, else statements
They are mutually exclusive, meaning that, in case of one being evaluated then, the others will not be executed at all.
if(condition1) -> needs to be a boolean value-> true or false
//body that executes in case the condition is true
}
else if(condition2)
{
//body that executes in case the condition 2 is true
}
else
{
//body that executes in case of any previous condition being true
}
- While Loops
while(condition)
{
//body that repeats under the condition being true
}
-
For Loops
The execution order is initialization, comparison, body, increment, then, again comparision
for (initialization; comparison; increment)
{
//body to repeat
}
- Functions
[return type] function_name (parameters)
{
//body
return [a variable that is of the return type you specified]
}