Lesson 2.5: Truthiness Flashcards

1
Q
if true
  puts 'hi'
else
  puts 'goodbye'
end
A

You can use the two boolean objects in conditionals.

Example 1 - The question will always output ‘hi’.

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

You can use the two boolean objects in conditionals.

Example 1 - The below will always output ‘goodbye’.

A
if false
  puts 'hi'
else
  puts 'goodbye'
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

code expression

A

An expression is a chunk of Ruby code that the Ruby interpreter can evaluate to produce a value.

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

short-circuiting

A

Short-circuiting is a programming concept by which the compiler skips the execution or evaluation of some sub-expressions in a logical expression. The compiler stops evaluating the further sub-expressions as soon as the value of the expression is determined.
https://www.geeksforgeeks.org/short-circuit-evaluation-in-programming/

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

Truthiness

A

In fact, Ruby is a very liberal language and considers everything to be truthy other than false and nil.

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