Control Flow
Option 2
Where We Are
We have developed an understanding of the
following technologies:
HTML
CSS
The final front-end development te...
Flow Control
JavaScript is programming
Programming is simply a series of instructions
~ think recipe
Flow Control
Sometimes the ingredients change
~ variables
Sometimes steps are repeated
~ loop
Flow Control
Sometimes steps are changed or omitted
~ conditional statements
Sometimes instructions are common to several
...
Pseudo Code
Simply explain what you want to happen in
plain English
Recipe example
~ explain how to make pasta
Pseudo Code
Step 1: assemble ingredients
Step 2: boil water
Step 3: add pasta
Step 4: heat pasta sauce
Step 5: combine pas...
Apply to a Web Page
Let’s look at an example:
~ Google “weather Boston”
Apply to a Web Page
variables: weather and time
loop: eight times (8 weather/time pairs)
conditionals: change icon dependi...
Pseudo Code
Step 1: assemble ingredients
time = 6:00 am
temperature = 50 degrees
Step 2: print ingredients
Pseudo Code
Step 3: change time and temperature
time = 9:00 am (increase time by 3 hours)
temperature = 52 degrees (increa...
Assignment
Write pseudo code to display the bottom row
~ day of week (variables)
~ icons (conditionals)
~ high and low tem...
Upcoming SlideShare
Loading in …5
×

General Assembly

321 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
321
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

General Assembly

  1. 1. Control Flow Option 2
  2. 2. Where We Are We have developed an understanding of the following technologies: HTML CSS The final front-end development technology: JavaScript
  3. 3. Flow Control JavaScript is programming Programming is simply a series of instructions ~ think recipe
  4. 4. Flow Control Sometimes the ingredients change ~ variables Sometimes steps are repeated ~ loop
  5. 5. Flow Control Sometimes steps are changed or omitted ~ conditional statements Sometimes instructions are common to several recipes ~ function
  6. 6. Pseudo Code Simply explain what you want to happen in plain English Recipe example ~ explain how to make pasta
  7. 7. Pseudo Code Step 1: assemble ingredients Step 2: boil water Step 3: add pasta Step 4: heat pasta sauce Step 5: combine pasta and sauce Step 6: serve
  8. 8. Apply to a Web Page Let’s look at an example: ~ Google “weather Boston”
  9. 9. Apply to a Web Page variables: weather and time loop: eight times (8 weather/time pairs) conditionals: change icon depending on weather conditions functions: a more advanced topic for later
  10. 10. Pseudo Code Step 1: assemble ingredients time = 6:00 am temperature = 50 degrees Step 2: print ingredients
  11. 11. Pseudo Code Step 3: change time and temperature time = 9:00 am (increase time by 3 hours) temperature = 52 degrees (increase temperature by 2 degrees) Step 4: repeat eight times
  12. 12. Assignment Write pseudo code to display the bottom row ~ day of week (variables) ~ icons (conditionals) ~ high and low temperature (variables) ~ how many times? (loop)

×