When I was creating an automatic trading tool for bitcoin, I sometimes used it with arguments, so I will record it.
The method definition is as follows.
def method name(Variable 1,Variable 2, ...)
Process to be executed
end
The expression when calling the method looks like this:
Method name(Argument 1,Argument 2, ...)
number.rb
def number(a,b)
return a * b
end
puts number(3,4)
#Execution result will be 12
3 is called for a and 4 is called for b as the argument of the number method. As a result, 3x4 is executed and 12 is output.
Recommended Posts