Horje
Ruby | Numeric finite?() function

The finite?() is an inbuilt method in Ruby returns a boolean value. It returns true if the number is a finite one, else it returns false.

Syntax: num.finite?()

Parameters: The function needs a number which is to be checked for.

Return Value: It returns returns a boolean value.

Example 1:




# Ruby program for finite?()
# method in Matrix
  
# Initialize a number 
num1 = 15
  
# Prints finite or not 
puts num1.finite?()

Output:

true

Example 2:




# Ruby program for finite?()
# method in Matrix
  
# Initialize a number 
num1 = 1/0.0
  
# Prints finite or not 
puts num1.finite?()

Output:

false



Reffered: https://www.geeksforgeeks.org


Ruby

Related
Ruby | Numeric floor() function Ruby | Numeric floor() function
Ruby | Numeric imaginary() function Ruby | Numeric imaginary() function
Ruby | Numeric imag() function Ruby | Numeric imag() function
Ruby | Date <=>() method Ruby | Date <=>() method
Ruby | Time utc function Ruby | Time utc function

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
9