Section 1

Preview this deck

comparison operators

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (34)

Section 1

(34 cards)

comparison operators

Front

used to test the relationship between two objects. the equality (==) and inequality (!=) operators can be used on almost any type of values. other operators are only used for numeric comparisons.

Back

||

Front

returns true if either boolean1 or boolean2 are true

Back

variables

Front

Variables are assigned values using the = operator, which is not to be confused with the == sign used for testing equality. A variable can hold almost any type of value including numbers, strings, arrays, and hashes.

Back

integer

Front

a number

Back

&&

Front

returns true if boolean1 and boolean2 are both true

Back

array

Front

data type that holds an ordered collection of values, which can be any type of object incl other arrays

Back

=end

Front

end of multi-line comment

Back

#

Front

single line comment

Back

=begin

Front

start of multi-line comment

Back

array.uniq

Front

remove duplicates from an array using array.uniq

Back

print

Front

print text to the terminal excl a new line

Back

if

Front

if the boolean expression is true do something

Back

.times

Front

built in iterator function in Ruby. It performs an action a given number of times.

Back

!boolean

Front

returns the opposite of boolean

Back

array.each

Front

you can iterate over the elements in an array using array.each, which takes a block

Back

puts

Front

prints text to the terminal incl a new line

Back

and

Front

same as && but with lower precedence

Back

boolean

Front

true or false statement

Back

while loop

Front

will execute a block of code as long as its condition is true. when the condition becomes false, the code after the end of the loop will be executed

Back

hashes

Front

collection of key-value pairs.

Back

until loops

Front

will execute a block of code as long as its condition is false. when the condition becomes true, the code at the end of the loop will be executed

Back

unless

Front

if the boolean expression is false do something

Back

array.flatten

Front

returns a one-dimensional version of a multi-dimensional array. it does not overwrite the array with the new array.

Back

float

Front

number with decimal

Back

elsif

Front

a statement that runs certain code only if the previous conditional statements do not run and its boolean expression evaluates to true (must be paired with 'if' or 'unless' block and takes a boolean expression as it's argument

Back

string

Front

anything in quotations

Back

else

Front

take no arguments, runs code if all previous conditional statements do not run

Back

methods

Front

used to create parameterized, reusable code

Back

or

Front

same as || but with lower precedence

Back

blocks

Front

a chunk of code that lives inside a control statement, loop, method, definition, or method call. it returns the value of the last line. created with braces or do/end statements.

Back

not

Front

same as !boolean butwith lower precedence

Back

for loops

Front

used to iterate an object. ruby prefers use of .each method

Back

logical operators

Front

used to compare boolean values. ruby has 6.

Back

.each

Front

built in iterator function in ruby. it loops through each item in a list, hash etc and allows you to perform operations on that value.

Back