Last active
December 18, 2015 18:18
-
-
Save elenawalom/5824340 to your computer and use it in GitHub Desktop.
day4notes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9:15 Homework | |
10:00 Arrays | |
10:30 Break | |
10:40 Loops | |
12:15 Lunch | |
1:15 Hashes | |
2:45 Break | |
3:00 Lab | |
$ often used to mean end of line or end of file | |
In ruby, $ indicates end of file. | |
If you receive $end in an error message, Ruby is telling you that at some point something went wrong but Ruby didn't determine what it was, so it proceeded. Eg, declare an array or object without closing it. Normally related to not having closed (if, while, array symbol, object symbol) | |
Errors are always better than warnings. | |
View Syntax Ruby to view Sublime in color | |
Debugging | |
puts and p are there to help you learn and find bugs | |
{} = hash literal | |
2 cases where hashes primarily used | |
1) Loose data that needs to be formalized, accessible and clear to rpgrammer using it | |
2) Map from one unique identity to another | |
No order in hash, only in arrays. (Most of the time, no order in hash.) | |
How do we index into arrays? Using numbers. | |
How do we index into hashes? Using a key. | |
K and I are commonly used to index into hashes and arrays. | |
e[k] in this case, e = hash. | |
f[i] in this case, f = array. | |
Best practices when coding in Ruby | |
k = key | |
v= value at k | |
i = integer/number | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment