Created
March 29, 2016 12:58
-
-
Save brianbancroft/35f04371ec5feba2b76c to your computer and use it in GitHub Desktop.
Playing around with Ruby command line
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
vagrant [tu (master)⚡]> pry | |
[1] pry(main)> my_array = [5,3,7,2] | |
=> [5, 3, 7, 2] | |
[2] pry(main)> my_array.sort | |
=> [2, 3, 5, 7] | |
[3] pry(main)> my_array | |
=> [5, 3, 7, 2] | |
[4] pry(main)> my_array.sort! | |
=> [2, 3, 5, 7] | |
[5] pry(main)> include Math | |
=> Object | |
[6] pry(main)> from Math import Math | |
NoMethodError: undefined method `import' for main:Object | |
from (pry):6:in `__pry__' | |
[7] pry(main)> Math.sqrt(2) | |
=> 1.4142135623730951 | |
[8] pry(main)> Math.sqrt(-1) | |
Math::DomainError: Numerical argument is out of domain - "sqrt" | |
from (pry):8:in `sqrt' | |
[9] pry(main)> puts "Problems? Must be my imagination..." | |
Problems? Must be my imagination... | |
=> nil | |
[10] pry(main)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment