Screenshot below
Screenshot below of Terminal installs
Did you run into any issues?
Nope! (I have done all of this before while self-teaching)
How do you open Atom from your Terminal?
-
$atom to be accessed from the Terminal in Atom settings
-
$atom touch filename to create a new file; $atom filename to open an existing file
What is the file extension for a Ruby file?
.rb
What is the Atom shortcut for hiding/ showing your file tree view?
Command-B
What is the Atom shortcut for quickly finding a file (fuzzy finder)?
Command-P
What does pwd stand for, and how is this command helpful?
Print working directory - tells you what directory you're in if Terminal is unclear
What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
Hostname shows you the name of your computer within your network. Hostname in my terminal shows Katies-MacBook-Pro.local
Screenshot below
Screenshots posted below - Codecademy course complete; mkdir, cd, ls sections of Learn Code the Hard Way complete
How do you start and stop irb?
irb; exit
What might you use irb for?
Testing simple ideas - math operators, basic strings and arrays, etc.
How do you create a variable?
Just type the name you want, an equals sign, and its value
What did you learn about the rules for naming variables?
You can use all letters, underscores, and numbers between letters in names. All numbers, dashes, and numbers at the start/end don't work.
How do you change the value of a variable?
Type its name again, then reassign it to the new value with =
How can you find out the class of a variable?
Type its name and .class
What are two string methods?
.length and .reverse
How can you change an integer to a string?
.to_s
Why might you use double quotes instead of single quotes in Ruby?
Double quotes allow you to use string interpolation and the escape sequence
What is this used for in Ruby: #{}?
String interpolation - you can call a variable in the middle of a string
How would you remove all the vowels from a string?
"string".delete('aeiou')
What do 'print' and 'puts' do in Ruby?
Print prints the output to the terminal as-is; puts gives the output its own new line
What does 'gets' do in Ruby?
Retrieves user input
Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".
Screenshot below
Screenshot below
What is the difference between integers and floats?
Integers are whole numbers; floats are numbers with decimal points.
Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
Screenshot below
What do each of the following symbols mean?
==
Checks equality on either side of the operator
=
Takes an item to the left of the operator and assigns it the value to the right of the operator
<=
Less than or equals to
!=
Not equal to
&&
"and" operator - if values on both sides of operator are true, expression evaluates true
||
"or" operator - if a value on either side of the operator is true, expression evalues true. If neither are true, evaluates false
What are two Ruby methods that return booleans?
.include? and .empty?
What is flow control?
Selectively executing code based on values that exist in the program.
What will the following code return?
"Not many apples..."
What is an infinite loop, and how can you get out of one?
It's created when you write a loop that has no exit or break point - it keeps executing forever. Type CTRL + C to break it.
Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
Screenshot below
What is nil?
A special Ruby data type that means "nothing"
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
Screenshot below
How can symbols be beneficial in Ruby?
They allow Ruby variables to point to the same object in many different places, using less memory, which is important for complex programs.
Does naming symbols use the same rules for naming variables?
Variables: You can use all letters, underscores, and numbers between letters in names. All numbers, dashes, and numbers at the start/end don't work.
Symbols: You can use all letters, underscores, numbers at the end, and numbers between letters in names. All numbers, dashes, and numbers at the start don't work.
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".
Screenshot below
What method can you call to find out how many elements are in an array?
.length
What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
[0]
What do 'push' and 'pop' do?
.push adds an element to the end of an array; .pop removes the last element from the array
Describe some differences between arrays and hashes.
An array is an ordered, indexed list of items; a hash is an ordered list of items that are identified by keys or values
What is a case when you might prefer an array? What is a case when you might prefer a hash?
An array is ideal for when you need an ordered list of items; a hash is for when you need to call items from a list based on their name.
An array could be used to store ages for a group of people: [6, 17, 84, 33, 19]
A hash could be used to store information about a group of people: {Joan => "mom", Bill => "dad", Frank => "brother"}
Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".
Screenshot below
Screenshot below
Screenshot posted below
Screenshot below
How do you call a function and store the result in a variable?
Name the variable, the assign it to the function with =
Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
Initialize method creates a new method for you to use on your objects. New method creates a new instance of your object (defined in the Class parameter at the top). Instance variables store data that's only usable by that particular object.
I am familiar with creating my own classes and methods through my work in Second Shift. This overview will be helpful for completing the assignments I'm still working on, which involve creating my own classes and methods and using MiniTest to test them.
Screenshot below
Screenshot below
Completion of my installs in Terminal