Intro To Programming:

Content Flow & Pseudo Code

Objectives

  • Understand Control Flow
  • Understand and write Pseudo Code
  • Write the pseudo code for a thermostat

Control Flow

  • Code is read left to right, top to bottom
  • Functions are executed in sequential order
  • Conditionals and Loops can alter the flow by skipping or repeating lines of code

Pseudo Code

  • Written in natural language
  • Non-functional
  • Used to help plan the control flow of a program
  • Helps understand Programming Logic without the need to learn a programming language

Oral Practice:

Using a shower.

Oral Practice:

Verbally explain the control flow of a shower:

  • Turning on the water
    • Hot
    • Cold
  • Turning off the water
  • Turning on the shower head
  • Turning off the shower head

is_water_on = false

when user turns water knob

     if is_water_on = true,

         turn off water

     else if is_water_on = false,

         is_water_on = true

        if knob turned is hot,

             start hot water

        if knob turned is cold,

            start cold water

 

 

Shower Pseudo Code

Thermostat Pseudo Code

  • Set a desired temperature
  • Run thermostat to adjust to desired temperature

Intro To Programming Recap:

  • Control flow dictates how our code is read
  • Programs are read left to right, top to bottom
  • Pseudo Code helps us plan out the control flow of our program

GA Sample Teach

By matt-soria

GA Sample Teach

  • 1,481