reading-notes

Reading notes for Code Fellows!


Project maintained by William-Moreno Hosted on GitHub Pages — Theme by mattgraham

Operators and Loops


Operators

Two types of operators are comparison operators and logical operators. Comparison operators evaluate a situation and return Boolean values of either true or false.

Comparison Operators

Logical operators compare the results of more than one comparison operator, also returning a Boolean value.

Logical Operators

Loops

Loops are programming tools that check for a condition and run a specified block of code if the condition returns true. After executing the block of code, the loop checks the condition again and continues to repeat the block of code intil a check returns false. Then the loop is exited.

There are three common types of loops:

For Loop Counters

The for lopp uses a counter as a condition to instruct the code to run a specified number of times. The counter of a for loop consists of three parts: initialization, condition and update and is contained in the parenthesis following the for keyword. Here is an example of a for loop set up:

for (var i = 0; i < 10; i++) {
  // Code goes here
}

Back to Main