- screenshots of scores will be posted in comments
- screenshots of completed sections will be posted in comments
- Did you run into any issues? My updates went smoothly!
- How do you open VS Code from your Terminal? code
- What is the file extension for a Ruby file? .rb
- What is the Atom shortcut for hiding/ showing your file tree view? Shift+Cmd+E
- What is the Atom shortcut for quickly finding a file (fuzzy finder)? Cmd+F
- 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" and shows you where you are in the file structure. Helpful for determining your location and how to navagate to the file you need.
- What does hostname tell you, and what shows up in YOUR terminal when you type hostname? hostnames identify your computer or server. hostname: anniewolff$
IRB
- How do you start and stop irb? type "irb" into the terminal to open and "exit" to close
- What might you use irb for? irb is good for running simple programs and testing ruby code
Variables
- How do you create a variable? some_variable = "Some value"
- What did you learn about the rules for naming variables? Variables can be named by combinations of letters and numbers, as long as the number does not begin the name. Additionally, variables cannot have only numbers in their name.
- How do you change the value of a variable? To reassign the value of a variable, simply type the name of the variable and pass it a different value. some_variable = 5 some_variable = 10
Datatypes
- How can you find out the class of a variable? Some_value.class
- What are two string methods? .upcase, .reverse
- How can you change an integer to a string? 5.to_s
Strings
- Why might you use double quotes instead of single quotes in Ruby? Using double quotes on a string allows for interpolation.
- What is this used for in Ruby: #{}? String interpolation name = 'Annie' "Hello #{Annie}"
- How would you remove all the vowels from a string? 'Any sentence'.downcase.delete('aeiou')
Input & Output
- What do 'print' and 'puts' do in Ruby? They return a string that has been input. puts starts a new line while print does not
- What does 'gets' do in Ruby? "Get String". It asks the user to input a string which is returned to the program.
- 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? integers are round numbers, while floats have decimal points.
- 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?
- == equal to
-
= greater than or equal to
- <= less than or equal to
- != not equal to
- && and
- || or
- What are two Ruby methods that return booleans? .include?, .empty?
Conditionals
- What is flow control? A way for a program to selectively execute code based on values that it has been passed.
- What will the following code return? "Not many apples..."
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 is a conditional that never returns false that can crash your program. To get out, press cmd+c.
- 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? Nil is the absence of a value.
- 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? Symbols use less memory so allow ruby to run a program more quickly
- Does naming symbols use the same rules for naming variables? Yes, but they begin with :
- 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? .length
- What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]? 0
- What do 'push' and 'pop' do? .push will add a value to the end of an array, .pop will remove the last value.
Hashes
-
Describe some differences between arrays and hashes. Arrays are a collection of indexed values, while the values in hashes are accessed by keys.
-
What is a case when you might prefer an array? What is a case when you might prefer a hash? Hashes are good for storing the attributes of an object, while arrays are good at ordered lists
-
- 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?
- I made it through the work without too much trouble, and never felt like i needed to rush to get it all done. I did let myself fall a little behind, but catching up wasn't too hard.
- What are you most looking forward to learning more about?
- I'm looking forward to building more complex programs with ruby!
- What topics would you most like to see reinforced by instructors?
- Building functions and multiple uses for classes. I'm interested in taking real-world situations and building progams to solve them!
- What is most confusing to you about what you've learned?
- Loops trip me up, but I think more practice will help.
- What questions do you have for your student mentor or for your instructors?
- What was the most helpful preparation that you took when beginning to learn programming?
(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?
- Functions are called by beginning with 'def' and closing with 'end'. To store the result as a variable define a variable and then pass it the value of a function.
- Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
- initialize tells ruby the values it should store when a new instance of a class is created wby using the new method. instance variable begin with the @ sign and are variables that are only accessable from inside a instance of the class.
- 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"?
Lol
![methods_or_functions](https://cloud.githubusercontent.com/assets/18703294/18458486/7f9e4af2-792f-11e6-8bbb-58274e62bcc2.png)