Open In App

Ruby | Integer * method

Last Updated : 18 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The * is an inbuilt method in Ruby returns the multiplication of two numbers. It returns num1 * num2.

Syntax: num1 * num2

Parameters: The function accepts no parameter.

Return Value: It returns the multiplication of two numbers.

Example 1:




# Ruby program for * method in Integer 
    
# Initialize numbers 
num1 = 15
num2 = 4 
  
# Prints multiplication
print num1 * num2


Output:

60

Example 2:




# Ruby program for * method in Integer 
    
# Initialize numbers 
num1 = 21
num2 = 3 
  
# Prints multiplication
print num1 * num2


Output:

63

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads