Ruby | Numeric dup() function
The dup() is an inbuilt method in Ruby returns the number itself.
Syntax: num1.dup()
Parameters: The function needs a number.
Return Value: It returns itself only.
Example 1:
Ruby
# Ruby program for dup() method in Numeric# Initialize a numbernum1 = 1.7# Function usednum = num1.dup()# Prints dup() of numputs num |
Output:
1.7
Example 2:
Ruby
# Ruby program for dup() method in Numeric# Initialize a numbernum1 = 19# Function usednum = num1.dup()# Prints dup() of numputs num |
Output:
19



