- Looking at a flowchart (for all but the most basic scripts), the code can take more than one path, which means the browser runs different code in different situations. In this chapter, you will learn how to create and control the flow ofdata in your scripts to handle different situations.
- Scripts often need to behave differently depending upon how the user interacts with the web page and/or the browser window itself. To determine which path to take, programmers often rely upon the following three concepts:
- EVALUATIONS You can analyze values in your scripts to determine whether or note they match expected results.
- DECISIONS Using the results of evaluations, you can decide which path your script should go down.
- LOOPS
There are also many occasions where you will want to perform the same set of steps repeatedly.

- At the most basic level, you can evaluate two variables using a comparison operator to return a t rue or f al se value. In this example, a user is taking a test, and the script tells the user whether they have passed this round of the test. The example starts by setting two variables:
- pass to hold the pass mark
- score to hold the users score
- A for loop is often used to loop through the items in an array. In this example, the scores for each round of a test are stored in an array called scores. The total number of items in the array is stored in a variable called arrayl ength. This number is obtained using the l ength property of the array.
- The key difference between a whi 1 e loop and a do whi 1 e loop is that the statements in the code block come before the condition. This means that those statements are run once whether or not the condition is met.

