when something doesn’t work how you think it should you need to first
check the api, to see if the function your trying to call is
syntactically correct.
In both these cases, these functions don’t exist, at least, no as you’ve
called them. In general, ruby is an Object oriented language, you can
even send messages (call methods on) numbers:
5.times { |n| puts “Hello #{n}” }
You seem to be using functions in a C-language style. Anyway, to check
if the installation is correct, you can try using some of ruby’s core
classes: http://ruby-doc.org/core-2.3.1/
Summing two numbers only requires using the + operator:
=> 1 + 2
=> 1 + 2 + 3 + 4
Or you can sum the elements in an array with reduce:
If you want the square root of a number, the documentation is here: