- screenshots of scores will be posted in comments
- screenshots of completed sections will be posted in comments
- Completed
-
Did you run into any issues?
- No issues
-
How do you open Atom from your Terminal?
- atom .
-
What is the file extension for a Ruby file?
- .rb
-
What is the Atom shortcut for hiding/ showing your file tree view?
- cmd-\
-
What is the Atom shortcut for quickly finding a file (fuzzy finder)?
- cmd-t or cmd-p
- 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?
- It stands for "print working directory". It is helpful because it tells you where you are in your file structure.
-
What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
- hostname tells you the computer's network name. My hostname is "Roberts-MacBook-Pro.local".
IRB
-
How do you start and stop irb?
- Start irb from the command line using "irb". Stop irb by typing "exit" in the command line.
-
What might you use irb for?
- irb is good for testing small peices of code or testing a language's functionality.
Variables
-
How do you create a variable?
- Use the equals sign "=" to assign a value. The variable to assign goes on the left side of the equals sign.
-
What did you learn about the rules for naming variables?
- You cannot use variable names that contain only numbers, true/false, dashes, or numbers at the start.
-
How do you change the value of a variable?
- You reassign the variable with the new value. variable = 5 becomes variable = 10.
Datatypes
-
How can you find out the class of a variable?
- Use the method .class with the variable. For instance 5.class
-
What are two string methods?
- .insert
- .match
-
How can you change an integer to a string?
- Use the method .to_s. For instance 5.to_s
Strings
-
Why might you use double quotes instead of single quotes in Ruby?
- Using double quotes lets you use string interpolation with variables.
-
What is this used for in Ruby: #{}?
- You can use #{} inside a string for string interpolation. The variable or expression inside {} will be used inside of the rest of the string.
-
How would you remove all the vowels from a string?
- You can use the delete method with the vowels as the input argument. 'Remove vowels'.delete('aeiou')
Input & Output
-
What do 'print' and 'puts' do in Ruby?
- 'print' and 'puts' output a string to the command line, but 'puts' adds a new line at the end.
-
What does 'gets' do in Ruby?
- 'gets' pauses the execution of the scripts and waits for an input from the user (through the command line).
-
Add a screenshot in the comments of the program you created that uses 'puts' and 'gets', and give it the title, "I/O".
- (Added)
Numbers & Arithmetic
-
What is the difference between integers and floats?
- Integers are whole numbers, and floats are floating point numbers with decimals.
-
Complete the challenge, and post a screenshot of your program in the comments with the title, "Numbers".
- (Added)
Booleans
- What do each of the following symbols mean?
- == (equal to, not an assignment)
-
= (greater than or equal to)
- <= (less than or equal to)
- != (not equal to)
- && (and)
- || (or)
- What are two Ruby methods that return booleans?
- .end_with?
- include?
Conditionals
- What is flow control?
- Flow control is a way to let the program make decisions for us. It enables us to selectively execute code based on conditions.
- What will the following code return?
- This code will output "Not many apples..." because apple_count is less than 5.
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?
- An infinite loop happens when there is no condition to make the while loop false. You can exit an infinite loop by entering command+c.
-
Take a screenshot of your program and terminal showing two different outputs, and post it in the comments with the title, "Conditionals".
- (Added)
nil
-
What is nil?
- A special data type that means nothing. It can be used to show a variable hasn't been assigned anything yet or that a function returns nothing.
-
Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "nil".
- (Added)
Symbols
- How can symbols be beneficial in Ruby?
- Symbols can help with memory allocation. They are useful for tems that do not change throughout the program, similar to enumerations in other programming languages.
- Does naming symbols use the same rules for naming variables?
- Yes, symbols use the same rules.
- Take a screenshot of your terminal after working through Step 4, and post it in the comments with the title, "Symbols".
- (Added)
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"]?
- 0th
- What do 'push' and 'pop' do?
- push adds a new element to the end of an array with the value defined as the input argument
- pop removes the last element of an array and returns the value
Hashes
- Describe some differences between arrays and hashes.
- In arrays, you access elements using their index number. With hashes, you access elements using their key.
- What is a case when you might prefer an array? What is a case when you might prefer a hash?
- You might prefer an array if you have a dataset of ordered values. You might prefer a hash if you have items with properties like color, style, height, or any values associated with a name.
- Take a screenshot of your terminal after working through Step 2, and post it in the comments with the title, "Hashes".
- (Added)
- Were you able to get through the work? Did you rush to finish, or take your time?
- I took my time through it. I had a few hours a day to spend on the prework. So I finished in about 2.5 days. I did not feel rushed or overwhelmed.
- What are you most looking forward to learning more about?
- I really want to learn how all the pieces connect and talk to each other in web development. So far, the concepts we have learned so far have been siloed.
- What topics would you most like to see reinforced by instructors?
- From the prework, it would be interesting to learn more about how to utilize hashes.
- What is most confusing to you about what you've learned?
- The most confusing part for me was the command line exercise on pushd/popd. The example in the exercise wasn't clear as to what was actually going on. I looked up a video about pushd/popd and that cleared it up.
- What questions do you have for your student mentor or for your instructors?
- No big questions at this point - just eager to keep learning since I know there is a lot to learn.
(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.
- (Added) "Loops"
- What challenges did you try for "Summary: Basics"? Post a screenshot of one of your programs.
- I did all of the chalenges. Screenshot below "Summary: Basics".
- Functions: How do you call a function and store the result in a variable?
- You call a function using it's name. If a function is called "begin", then you can call it and store the output to a variable using: a = begin(input)
- Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
- intitialize method: stores data that is passed in when you create a new istance of the object
- new method: creates a new instance of the object
- instance variables: these are variables that are accessible only locally within a specific instance of the object
- 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.
- One confusing part for me was the array summation section of the code following total = 0. There seems to be an easier way to sum an array, so I'm not sure why the code is the way it is. The best part of this exercise was breaking down the code into functions.
- 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"?
Task E:
less
cat
rm