Logic and Flow Control

Logic and Flow Control
1 / 14
volgende
Slide 1: Tekstslide
Computer Science9-12 Grade

In deze les zitten 14 slides, met interactieve quizzen en tekstslides.

Onderdelen in deze les

Logic and Flow Control

Slide 1 - Tekstslide

What is Flow Control?
Flow control is how a computer moves from one task to another.

  • if-else
  • while
  • for
  • condition

Slide 2 - Tekstslide

If-Else Statement
If-Else tells the computer, IF something is true, do something, ELSE, do something ELSE.



Slide 3 - Tekstslide

Slide 4 - Tekstslide

While Loop
A while loop tells the computer to do something WHILE a condition is true.

Slide 5 - Tekstslide

Slide 6 - Tekstslide

For Loop
A for loop tells the computer to do something a specific number of times.

Slide 7 - Tekstslide

Slide 8 - Tekstslide

***Logical Operators ***
Logical operators tell the computer how to work with conditions.

Logical AND (&&) - Returns TRUE if both sides of the operator are true. 
ex ( true && true) = TRUE
Logical OR (||) - Return TRUE if any side of the operator is true. 
ex (true || false) = TRUE
ex (false || true) = TRUE
Logical NOT(!) - Returns the Opposite.
ex (true) = FALSE
ex (false) = TRUE

Slide 9 - Tekstslide

What is flow control?
A
The flow of if-else statements.
B
Flow control turns on the computer
C
A way to guide program execution.
D
Two or more logical operations

Slide 10 - Quizvraag

Which keyword tells the computer to loop as long as a condition is true?
A
While
B
If
C
Switch
D
&&

Slide 11 - Quizvraag

Which keyword tells the computer to do something, given that a condition is true
A
Int
B
Boolean
C
If
D
Break

Slide 12 - Quizvraag

When using the AND (&&) operator, how many parts of the condition must be True to pass?
A
One
B
Two
C
None
D
All

Slide 13 - Quizvraag

When using the Or (||) operator, how many parts of the condition must be True to pass?
A
One
B
Two
C
None
D
All

Slide 14 - Quizvraag