Lesson goal: Program Flow

Previous: Displaying nice looking math | Home | Next: Programming as a calculator

Computers always execute code from top to bottom and left to right. You can experiment a bit with this idea here. There are three separate statements in the code box below. The print statement tells the computer to display the text within the double quotes, on the screen. Click the "Run my code..." button to see how the computer processes these lines.

Next, arrange (cut and paste) the lines in any order you wish, and run the code again. Prove to yourself that computers run code from top to bottom.

Now you try. Change the top to bottom order of the three print lines. Convince yourself that computers execute code from top to bottom.

Type your code here:

See your results here: