Created
September 1, 2015 17:44
-
-
Save ruxandrafed/1f11c84d6ca3726340f2 to your computer and use it in GitHub Desktop.
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
[1] pry(main)> def say_bye(name) | |
[1] pry(main)* puts "Bye bye, #{name}! See you later!" | |
[1] pry(main)* end | |
=> nil | |
[2] pry(main)> say_bye("Rux") | |
Bye bye, Rux! See you later! | |
=> nil | |
[3] pry(main)> my_array = ["one", "two", "blabla"] | |
=> ["one", "two", "blabla"] | |
[4] pry(main)> my_array.sort | |
=> ["blabla", "one", "two"] | |
[5] pry(main)> my_array | |
=> ["one", "two", "blabla"] | |
[6] pry(main)> my_array.sort! | |
=> ["blabla", "one", "two"] | |
[7] pry(main)> my_array | |
=> ["blabla", "one", "two"] | |
[8] pry(main)> my_array.each { |word| puts word.length} | |
6 | |
3 | |
3 | |
=> ["blabla", "one", "two"] | |
[9] pry(main)> Math.sqrt(1282) | |
=> 35.805027579936315 | |
[10] pry(main)> Time.now | |
=> 2015-09-01 10:37:43 -0700 | |
[11] pry(main)> Array.new(10, 'no bee pls') | |
=> ["no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls", | |
"no bee pls"] | |
[12] pry(main)> include Math | |
=> Object | |
[13] pry(main)> sqrt(122) | |
=> 11.045361017187261 | |
[14] pry(main)> sqrt(121) | |
=> 11.0 | |
[15] pry(main)> sqrt 8 | |
=> 2.8284271247461903 | |
[16] pry(main)> sqrt 64 | |
=> 8.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment