Basic Code Academy Flashcards
What is ruby?
A programming language
To print something on the computer
Puts
What is rails?
Rails is framework to build Webb apps. Like the frames of a house already in place so one can focusing on building the details.
What is an web app?
Any software that runs in a web browser
name 5 objects
Strings Numbers Booleans Arrays Hashes
Name three types of methods
Methods
Loops
Control flow
Name three types of classes
Classes
Attributes
Instance variables
What are strings
Words or numbers between quotes
What are numbers (object)
Numbers. Ruby has two types, floats: numbers with decimals like 4.3. And integers: whole numbers, either positive or negative like 75 or -10.
What are booleans
True or false statements. 1==1 is true. 1==5 is a false statement.
How is a variable with strings declared?
a = "apple". a = "12"
How is a variable with numbers object declared?
A = 12 A = 12.5 A = 22 + 12.5
How is a variable with booleans declared? True and false
A = (1 == 1) A = (1 == 6)
True
False
What is arrays?
An object. Its a list of objects too.
How is an array created?
By declaring array name and listing the objects between brackets:
A = [“Sebastian”, “Jonas”, “Lisa”]
What is an object in an array list called?
An element
How is an element in an array accessed?
Array name and the index number:
Puts a[0]
=> “Sebastian”
What are hashes?
An object. Helps store information as pairs, key and value.
How are hashes declared?
Menu = {“pizza” => 14.00, “soda” => 2.00, “pasta” => 8.00}
What type of object is declared? Which is key and which is value?
Menu = {“pizza” => 14.00, “soda” => 2.00, “pasta” => 8.00}
Menu hash
The foods key
The prices value
How is the value of a key in a hash object accessed?
From
Menu = {“pizza” => 14.00, “soda” => 2.00, “pasta” => 8.00}
Menu[“pasta”]
Result
=> 8.00
What is a variable?
They are used to store objects so we can access them again. Any object can be stored as a variable.
What’s the terminal command to list the content of the current directory?
ls
What’s the terminal command to list the content of the current directory, including hidden files?
ls -a