Conditionals & IF Statements

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

What does an equality condition check?

Whether two values are the same.

2
New cards

How do you write "is equal to" in code?

==

3
New cards

How do you write "not equal to" in code?

!=

4
New cards

What are relational operators used for?

To check whether values are higher or lower than each other.

5
New cards

What symbol means "less than"?

<

6
New cards

What symbol means "less than or equal to"?

<=

7
New cards

What symbol means "greater than"?

>

8
New cards

What symbol means "greater than or equal to"?

>=

9
New cards

What does the logical AND do?

It passes only if both left and right conditions are true.

10
New cards

What happens if one side of an AND is false?

The overall statement fails.

11
New cards

What does the logical OR do?

It passes if at least one of two conditions is true.

12
New cards

What are logical operators used for?

To group and evaluate multiple conditions using AND/OR.

13
New cards

What is an IF statement used for?

To perform an action when a condition is true.

14
New cards

What does the IF statement evaluate?

Whether a condition is true or false.

15
New cards

What happens when the condition in an IF statement is true?

The associated code is executed.

16
New cards

What is an ELSE used for in an IF statement?

To define what to do if the condition is not met.

17
New cards

What does IF/ELSE allow your code to do?

Follow different paths depending on whether the condition is met.

18
New cards

What happens if the IF condition is false?

The code in the ELSE block is executed.

19
New cards

What does ELSE IF (or ELIF) do?

Allows checking multiple conditions in sequence.

20
New cards

What happens if no IF or ELSE IF conditions are true?

The ELSE block (if present) is executed.

21
New cards

Why use ELSE IF or ELIF?

To test several conditions one by one until one is met.