Skip to content

Latest commit

 

History

History
68 lines (25 loc) · 974 Bytes

6. Controle Structures - Part II.md

File metadata and controls

68 lines (25 loc) · 974 Bytes

Controle structures - Part II

Controle structures

  • Sequence logic, or sequential flow

  • Selection logic, or conditional flow

  • Iteration logic, or repetitive flow (today's focus)

Two types of loops

  • For loop

  • While loop

Programming workflow

  • There is raw data

  • Raw data should be processed - Functions

  • Processed data should be stored

Computers can do 3 things

  • Repeat sth large number of times (today's focus)

  • Remember results

  • Decide when to stop

Loops

  • Loops are used when we want to execute same part of code multiple times or
  • When you want to execute same part of code while some condition is true.

For loop

  • When you know in advance how many iterations you will have

While loop

  • Used when we do not know how many times some algorithm should be executed.
  • We need to check condition every time, in order to know do we need to stop.

To be continued!!!