Flow Control Flashcards

1
Q

In Ruby, every expression evaluates as true when used in flow control, except for ___ and ___.

A

False and nil

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

conditional flow

A

When I am writing programs, I want my data to make the right decisions. I want my data to do the right thing it’s supposed to. In computer programming, this is called conditional flow

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

Conditionals

A

a fork (or many forks) i the road. My data approaches a conditional and the conditional then tells the data where to go based on some defined parameters.Formed using a combination of if statements and comparison and logical operators ( , <=, >=, ==, !=, &&, ||). Basic logical structures defined with the reserved words:

  • if,
  • else,
  • elsif,
  • end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

boolean value

A

true or false, nothing else.

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

operands

A

expressions or values that an operator uses. In comparison, the expressions to the left and right of the operator are operands.

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

!=

A

The “ not equal to” operator. Anything to the left of the symbol is not equal to anything on the right.

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

>

A

“less than” symbol. Anything to the left of the symbol has a lower value than anything to the right

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

>

A

The “greater than” symbol. Anything to the left of the symbol has a higher value than anything to the right of the symbol.

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

When comparing strings, the comparison is _______________

A

character-by-character. Ruby moves from left-to-right in the strings looking for the first character that is different from its counterpart in the other string. Once it finds a character that differs, it compares that character with its counterpart and makes a decision based on that. If both strings are equal up to the length of the shorter string, then the shorter string is considered less than the longer string.

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

<=

A

“less than or equal to” symbol. Anything to the left of the symbol is less than or equal to anything on the right.

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

> =

A

“greater than or equal to” symbol. Anything to the left of the symbol is greater than the or equal to anything on the right.

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

&&

A

the “and” operator. Expressions to the left and the right of this operator have to be both true for the entire expression to be evaluated to true.

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

|

A

the “or” operator. Either the expression to the left has to be true, or the expression to the right has to be true for the entire expression to be evaluated to true.

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