Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active June 8, 2017 22:46
Show Gist options
  • Select an option

  • Save rogerwschmidt/07ac739ea7c40082c1ae71d316a91ffc to your computer and use it in GitHub Desktop.

Select an option

Save rogerwschmidt/07ac739ea7c40082c1ae71d316a91ffc to your computer and use it in GitHub Desktop.

Control Flow

Objectives

  • Use if/else statements to conditionally execute code
  • Use while loops to conditionally repeat statements
  • Use for loops to iterate a specific number of times

Use if/else statements to conditionally execute code

Given the following variable

var grade = 89;

On your table, create a set of if/else statements that prints out a grade.

  • A = 90 - 100
  • B = 80 - 89
  • C = 70 - 79
  • D = 60 - 69
  • F = 0 - 59

Use while loops to conditionally repeat statements

Use a while loop to print a count from 0 to 10;

Use for loops to iterate a specific number of times

Use a for loop to print a count from 0 to 10;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment