- screenshots of scores will be posted in comments
- screenshots of completed sections will be posted in comments
- Did you run into any issues?
- How do you open Atom from your Terminal?
- What is the file extension for a Ruby file?
- What is the Atom shortcut for hiding/ showing your file tree view?
- What is the Atom shortcut for quickly finding a file (fuzzy finder)?
- screenshots of your terminal after each exercise will be posted in comments
Day One Questions:
- What does pwd stand for, and how is this command helpful?
- What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
IRB
- How do you start and stop irb?
- What might you use irb for?
Variables
- How do you create a variable?
- What did you learn about the rules for naming variables?
- How do you change the value of a variable?
Datatypes
- How can you find out the class of a variable?
- What are two string methods?
- How can you change an integer to a string?
Strings
- Why might you use double quotes instead of single quotes in Ruby?
- What is this used for in Ruby: #{}?
- How would you remove all the vowels from a string?
Input & Output
- What do 'print' and 'puts' do in Ruby?
- What does 'gets' do in Ruby?
- Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".
Numbers & Arithmetic
- What is the difference between integers and floats?
- Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
Booleans
- What do each of the following symbols mean?
- ==
-
=
- <=
- !=
- &&
- ||
- What are two Ruby methods that return booleans?
Conditionals
- What is flow control?
- What will the following code return?
apple_count = 4
if apple_count > 5
puts "Lots of apples!"
else
puts 'Not many apples...'
end
- What is an infinite loop, and how can you get out of one?
- Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
nil
- What is nil?
- Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
Symbols
- How can symbols be beneficial in Ruby?
- Does naming symbols use the same rules for naming variables?
- Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".
Arrays
- What method can you call to find out how many elements are in an array?
- What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?
- What do 'push' and 'pop' do?
Hashes
- Describe some differences between arrays and hashes.
- What is a case when you might prefer an array? What is a case when you might prefer a hash?
-
- Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".
- Were you able to get through the work? Did you rush to finish, or take your time?
- What are you most looking forward to learning more about?
- What topics would you most like to see reinforced by instructors?
- What is most confusing to you about what you've learned?
- What questions do you have for your student mentor or for your instructors?
(Note: You will most likely only get to the following sections if you have more than a week for your pre-work. If you are doing the one week pre-work schedule, you may delete this section of the Gist.)
- Loops: Take a screenshot of your "Challenge" program, and post it as a comment in your Gist.
- What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs.
- Functions: How do you call a function and store the result in a variable?
- Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
- How to Write a Program: Screenhero with your student mentor and share your program. Write a bit about what you found most challenging, and most enjoyable, in creating your program.
- screenshots will be posted in comments
- What are your three biggest takeaways from working through this book?
- screenshots will be posted in comments
- What are your two biggest takeaways from working through this tutorial?
- What is one question you have about Git & GitHub?
- Describe your thinking on effective workflow. What shortcuts do you think you'll find most useful? What would you like to learn or practice that will most help you improve your speed and workflow?
As you complete each section, respond to the related questions below (mostly taken directly from the tutorial exercises):
- 1.3: By reading the "man" page for echo, determine the command needed to print out “hello” without the trailing newline. How did you do it?
- 1.4: What do Ctrl-A, Ctrl-E, and Ctrl-U do?
- 1.5: What are the shortcuts for clearing your screen, and exiting your terminal?
- 2.1: What is the "cat" command used for? What is the "diff" command used for?
- 2.2: What command would you use to list all txt files? What command would you use to show all hidden files?
- 3.1: How can you download a file from the internet, using the command line?
- 3.3: Describe two commands you can use in conjunction with "less".
- 3.4: What are two things you can do with "grep"?
Days 2-7 Task F - Choose your own Ruby Adventure (Option 1)
What is Ruby?
![irb 1](https://cloud.githubusercontent.com/assets/17547270/15657685/514f9e56-2670-11e6-8893-58884048c533.png)
![running programs from a file](https://cloud.githubusercontent.com/assets/17547270/15657777/6c8d9c62-2671-11e6-94b6-481c2082c96b.png)
Command Line
IRB
Questions from template:
How do you start and stop irb?
Type IRB
Type Exit
What might you use irb for?
It is a great place for experimenting and testing out how Ruby works - but not for long code since you can't save anything to it.
Running Programs from a File
Variables
Questions from Template:
How do you create a variable?
you create a variable by naming it, then typing = then assigning a value (my_variable = 20)
What did you learn about the rules for naming variables?
How do you change the value of a variable?
to change the value, you type the name of the variable you want to change, an = and a new value
Datatypes
How can you find out the class of a variable?
in irb, use the .class method
What are two string methods?
unicode_normalize and rpartition
How can you change an integer to a string?
in irb type, 5.to_s
you can then verify this by typing 5.to_s.class
Strings
Why might you use double quotes instead of single quotes in Ruby?
you would use double quotes instead of single quotes when you use string interpolation.
What is this used for in Ruby: #{}?
string interpolation: it contains any valid ruby statement - it embeds a Ruby statement into another string
How would you remove all the vowels from a string?
the method is .delete('aeiou')
Input & Output
What do 'print' and 'puts' do in Ruby?
puts "is a way of printing information to the user of your program"
prints does basically the same thing except that it does not add a new line after printing the text
What does 'gets' do in Ruby?
gets pauses the program and lets the user give an answer or provide input to your program and then hit the enter key. gets then takes that input and returns the value back to the program and moves on.
Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".
![challenge](https://cloud.githubusercontent.com/assets/17547270/15767377/b03acf76-2904-11e6-9633-ff90816b5dfc.png)
![challenge_run](https://cloud.githubusercontent.com/assets/17547270/15767378/b03b4b5e-2904-11e6-8dc3-05e79886cefc.png)
"I/O"
Numbers & Arithmetic
![calculator](https://cloud.githubusercontent.com/assets/17547270/15767480/94130d62-2905-11e6-94c4-e5421008eec4.png)
![calculator_run](https://cloud.githubusercontent.com/assets/17547270/15767481/9414c418-2905-11e6-81dc-b96bfbf078aa.png)
What is the difference between integers and floats?
integers are whole numbers and floats are decimals
Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
"Numbers"
Booleans
What do each of the following symbols mean?
== - equal to
Conditionals
What is flow control?
![conditionals_test2](https://cloud.githubusercontent.com/assets/17547270/15768150/a71720be-290b-11e6-93bd-33ddac8eaa54.png)
![conditionals_run2](https://cloud.githubusercontent.com/assets/17547270/15768162/bfe96aca-290b-11e6-99d2-c49f3d4fc82a.png)
it is when the program makes decisions for us - if/else/end, if/elsif/else/end
What will the following code return?
Not many apples...
What is an infinite loop, and how can you get out of one?
an infinite loop is a loop that has no stopping point - there is no logic in the code that completes the cycle so it repeats itself indefinitely.
You get out of it by typing CTRL+C on your keyboard
Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
"Conditionals"
nil
What is nil?
nil means "nothing" and is the same as null or None in other languages. it shows that value has not been assigned to a variable yet or that a vlue was not returned by a function.
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
![nil](https://cloud.githubusercontent.com/assets/17547270/15780805/9b0731c4-2960-11e6-88f1-0fc4770dae2c.png)
"nil"
Symbols
How can symbols be beneficial in Ruby?
they help Ruby use memory more efficiently by lettting Ruby varibales point to the same object in several places instead of making a new copy each time.
Does naming symbols use the same rules for naming variables?
No. Symbols always start with a colon (:) - that is not the case with variables. Symbols can have spaces if they are enclosed in "" or ''.
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".
![symbols](https://cloud.githubusercontent.com/assets/17547270/15781193/365f2fa4-2962-11e6-80c8-3837b7d75e0b.png)
"Symbols"
Arrays
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 a new element to the end of an array
pop removes (and returns) the element at the end of the array
Hashes
Describe some differences between arrays and hashes.
arrays will store items in a list in a particular order and we can retrieve those items by the position in the order. Hashes allow us to retriev an item based on a key. hases use curly brackets, arrays use square brackets. Hashes use a "hashrocket" =>.
What is a case when you might prefer an array? What is a case when you might prefer a hash?
You might prefer hashes if you are creating a catalog of inventory, contact list, etc.... where you can have a thing and its associated properties (like a bike with its model, color, year, wheel size, etc...). An array might be a better option if you are just listing items with no extra information. You use an array to show tje values of a hash in an array as well.
"Hashes"
![hashes](https://cloud.githubusercontent.com/assets/17547270/15782716/96025a0c-2968-11e6-82c8-093ffbc503b4.png)