Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

Ruby | Methods

# Ruby program to illustrate method return statement
 
#!/usr/bin/ruby
 
# geeks is the method name
def num
 
# variables of method
a = 10
b = 39
 
sum = a + b
 
# return the value of the sum
return sum
 
end
 
# calling of num method
puts "The result is: #{num}"
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Ruby #Methods
ADD COMMENT
Topic
Name
7+8 =