Skip to content

Instantly share code, notes, and snippets.

@maxahn
Created May 24, 2016 18:46
Show Gist options
  • Save maxahn/1840a41e3d0e994383900ee80a535fa7 to your computer and use it in GitHub Desktop.
Save maxahn/1840a41e3d0e994383900ee80a535fa7 to your computer and use it in GitHub Desktop.
Interactive Ruby (Practice) LHL
1: def say_hi
2: def say_hi(name)
3: "Hey, #{name}"
4: end
5: say_hi("Hannah")
6: a = "Hey"
7: b = "Hey"
8: a == b
9: a === b
10: a = 1343
11: a == b
12: a === b
13: b = "1343"
14: a === b
15: a == b
16: a.to_s === b
17: a.to_s == b
18: s = 1
19: s.to_string
20: s.to_s
21: s
22: s.to_s!
23: s = s.to_s!
24: s = s.to_s
25: s
26: a = [1,5,2]
27: a.sort
28: a.reverse
29: a.reverse!
30: a
31: a.sort
32: a
33: a.sort!
34: a.each do
35: x + 1
36: puts x + 1
37: end
38: a.each |x| do
39: a.each do |x|
40: puts x + 1
41: end
42: include 'Math'
43: include Math
44: sqrt 64
45: sqrt(64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment