LESSON 2 Flashcards

1
Q

What is a logic statement?

A

In coding, a logic statement is where the code has to pick between something being TRUE or FALSE. This allows us to make our code and products more complex and allows us to do more things.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the simplest logic statement and it’s structure?

A

The simplest logic statement is called an IF/ELSE statement.

IF (something is true) {
Do something;
}
ELSE {
Do something else;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What commands are in C++ coding?

A

Void setup
pinMode - Activates a specific pin as INPUT or OUTPUT
serial.Begin - Opens Serial Monitor/Output screen

Void Loop
analogWrite - Send power to (You determine the amount of power)
digitalWrite - Send Power to (Either HIGH or LOW)
digitalRead - Check this and tell me if there’s power (Either HIGH or LOW)
serial.Write - Write this message on the output screen
serial.Print Writes the output value on the output screen
delay - wait

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the other logic statements and their structures?

A

Another type of logic statement is the FOR statement. This allows us to iterate through a series of things.

FOR (declare an iterator; set a condition; increase or decrease) {
DO something with the iterator
Increase the iterator by some amount
Check whether the condition is TRUE or FALSE
}

The third type of logic statement is the WHILE statement. This allows us to repeat through a series of things until a condition is false. (The series could repeat infinitely.)

WHILE (make a condition and set it to TRUE) {
Do something;
Check whether the condition is still true;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly