- screenshots of scores will be posted in comments
- screenshots of completed sections will be posted in comments
- Did you run into any issues?
- Nope :)
- How do you open Atom from your Terminal?
- type 'atom' (although I'm using VS Code, & type
code
to open)
- type 'atom' (although I'm using VS Code, & type
- What is the file extension for a Ruby file?
.rb
- What is the Atom shortcut for hiding/ showing your file tree view?
- For VS Code, it's
cmmd-shift-E
- For VS Code, it's
- What is the Atom shortcut for quickly finding a file (fuzzy finder)?
- For VS Code, you can search for anything with
cmmd-shift-P
orcmmd-P
& type filename (Quick Open). If you want to navigate in and across files that are open within an editor group, holdctrl-tab
, scroll withtab
, then choose by releasingctrl
.
- For VS Code, you can search for anything with
- 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 present working directory, and it shows you the name of the directory, or folder, you are currently in. It's helpful to see which directory you are working in within the filesystem.
- What does hostname tell you, and what shows up in YOUR terminal when you type hostname?
-
This wasn't included in the video or the resources, but I looked it up and found that hostname "is the name assigned to the computer as visible from the command line, and it’s also used by local and remote networks when connecting through SSH and Remote Login" (osxdaily.com http://bit.ly/2gALfmF); in Cloud9, my hostname is vvasys-turing-prework-4140125
-
Questions for Prework Guide: What are they looking for with screenshots of completed quizzes? (Is there a better page than what I posted?) Which program is best for flash cards?
-
IRB
- How do you start and stop irb?
- Start by typing 'irb'; stop by typing 'quit'
- What might you use irb for?
- To experiment and play around with features of Ruby (not for writing long programs)
Variables
- How do you create a variable?
- Use the proper naming convention (lower case letter first, followed by additional letters, numbers and/or underscores), add an equals sign, and assign a value
- What did you learn about the rules for naming variables?
- See above.
- How do you change the value of a variable?
- Just reassign a new value (eg. name = 3; name = 4)
Datatypes
- How can you find out the class of a variable?
- Call the method .class on it (eg. name.class)
- What are two string methods?
- .upcase! and .chomp
- How can you change an integer to a string?
- Call the conversion method .to_s on it (eg. 5.to_s)
Strings
- Why might you use double quotes instead of single quotes in Ruby?
- For string interpolation (eg. "Hello number #{2 + 2}")
- What is this used for in Ruby: #{}?
- String interpolation (see above)
- How would you remove all the vowels from a string?
- Use the delete method (eg. "string".delete('aeiou'))
Input & Output
- What do 'print' and 'puts' do in Ruby?
- They output statements to the screen: 'print' prints with no new line after and 'puts' creates a line after
- What does 'gets' do in Ruby?
- It waits for the user to input something (stands for "get string")
- 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 whole numbers and floats carry a decimal place.
- 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?
- == "is equal to"
-
= "is greater than or equal to"
- <= "is less than or equal to"
- != "is not equal to"
- && "and"
- || "or"
- What are two Ruby methods that return booleans?
- :false? :even? :nil? :empty?
Conditionals
- What is flow control?
- It's a concept found in most programming languages that allows our program to make decisions for us. You can use the if ... else ... end construct and other conditionals to execute code based on values in the program.
- What will the following code return?
apple_count = 4
if apple_count > 5
puts "Lots of apples!"
else
puts 'Not many apples...'
end
- It returns "Not many apples..."
- What is an infinite loop, and how can you get out of one?
- It is a loop that continues to run forever because the conditionals to exit were never met. You can get out by typing ctrl+c, ctrl+d or closing/exiting the terminal.
- 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 a Ruby datatype that means "nothing" or that a variable hasn't been set or a function didn't return 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?
- For labeling something that is used over and over; they are memory-efficient because they are constants (keep the same object id)
- Does naming symbols use the same rules for naming variables?
- No; you can name a symbol anything inside of quotations (can use spaces)
- 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 adds an element to the end of an array & :pop removes and returns the element at the end of an array
Hashes
- Describe some differences between arrays and hashes.
- In an array, an element is accessed by indexing a number; it's an ordered list. In a hash, elements are accessed by their key, or label.
- 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 when you need your elements ordered by number, like with a data set where name identifiers would be cumbersome. Hashes are preferred when you're storing values that belong to a certain property, like "email" or "phone number," for example.
-
- 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.
- I tried all but the last (arrays) challenge. I posted my program for the 3rd challenge (sums) below.
- Functions: How do you call a function and store the result in a variable?
- You call a function by entering its name and sending values that it needs. You can store that into a variable by entering a variable name, equals sign and function call.
- eg.:
def exclaim(phrase)
phrase.upcase
end
loud = exclaim "hello"
- Describe the purpose of the following in Ruby classes: initialize method, new method, instance variables.
- initialize method: to save the initial data the object is created with and perform other required setup
- new method: create an instance of your object (arguments passed through :new are sent to :initialize)
- instance variables: store data on your object (they start with an '@' symbol and are only visible inside a specific instance of your object-- another method must be created in order to externally access data)
- 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.
- Most challenging = remembering the syntax for performing diffrent tasks, and discerning which parts of the class fit into which methods
- Most enjoyable = re-organizing to be clean & usable & combining many of the tools I've learned so far!
- 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 A- typing_2.4 12.19.16