conditional statements intro Flashcards

1
Q

0

A

means false

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

true

A

is defined as all other non-zero values

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

if/else syntax

A

if(boolean expression)
{
}
else
{
}

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

else if structure

A

else if(boolean expression)
{
{

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

else if()

A

allows one to be specific if the first (if) condition fails
*only executes if the previous condition fails

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

ternary operator syntax

A

condition ? expression_if_true: expression_if_false;

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

short circuiting

A

when the compiler skips evaluation of further conditions when possible
*possible when evaluating logical or/and
*best practice to write code that allows for this

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

one line if-else statements

A

refers to the code executed by the if-else statements
*other code will be interpreted as outside the if-else statement

correct:
if()
printf();
else
printf();

incorrect:
if()
printf();
printf();
else()
printf();

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