红宝石 |数值 conj()函数
conj()是 Ruby 中的一个内置方法,它返回数字本身。
Syntax: num1.conj()
Parameters: The function needs a number.
Return Value: It returns itself only.
示例 1 :
Ruby
# Ruby program for conj() method in Numeric
# Initialize a number
num1 = 1.7
# Function used
num = num1.conj()
# Prints conj() of num
puts num
Ruby
# Ruby program for conj() method in Numeric
# Initialize a number
num1 = 19
# Function used
num = num1.conj()
# Prints conj() of num
puts num
输出:
1.7
示例 2 :
红宝石
# Ruby program for conj() method in Numeric
# Initialize a number
num1 = 19
# Function used
num = num1.conj()
# Prints conj() of num
puts num
输出:
19