Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.67 KB

File metadata and controls

36 lines (27 loc) · 1.67 KB

operators and loops

this page will contain some info on loops and operators.

Loops

what are loops
loops are what we use to do a certain block of code a number of times this number may or may not be known this determines the type of loop used. the loops are controled with a conditoin and as longt as that condition holds true the code will be repeated.
loop types
there are 3 common loops which are:

  • for loops.
  • while loops.
  • do while loops.

for loop
for loop is used when we have an idea about the number of times the code should be repeated.

while loop
the while loop is used when we have no idea how many times the code should be repeated.

do while loop
this loop is similar to the while loop but the code will at least be excuted one time then the condition will be checked and it will run as while loop form this point on.

operators

what are operators
operators are symbols used to check or evaluate conditions. it has two operands and the operator symbol in the middle. the symbol or operator will determine what kind of evaluation would occure on the operands. the result will always be a boolean of true or false.

operator types
there are two operator types which are:

  • comparison operators.
  • logical operators.

comparison operators
comparison operators are used to compare the value and/or its type of an operand with the other.

logical operators
logical operators operands are used to compare the result of comparison operators. each operand will have a comparison operator expression that will be evaluated before the logical operator and then the logical operator will be evaluated.