Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

isinteger
julia
method
communitycreator

How to use the isinteger method in Julia

Programming Bytes

Overview

In Julia, the isinteger(x) method checks whether or not the given value is equal to an integer.

Syntax

The syntax of the method is given below:

isinteger(x) -> Bool
Julia isinteger function Syntax

Argument

x: This is the value that is to be checked.

Return value

This method returns true if the provided value is numerically equal to an integer value. Otherwise, it returns false.

Code

The code below demonstrates the use of the isinteger method:

## find isinteger of 3.0
println( "isinteger(3.0) => $(isinteger(3.0))")

## find isinteger of 10
println( "isinteger(10) => $(isinteger(10))")

## find isinteger of 3.5
println( "isinteger(3.5) => $(isinteger(3.5))")
Using the isinteger method

Explanation

Line 2: We use the isinteger method with 3.0 as an argument. The isinteger(3.0) returns true.

Line 5: We use the isinteger method with 10 as an argument. The isinteger(10) returns true .

Line 8: We use the isinteger method with 3.5 as an argument. The isinteger(3.5) returns false because 3.5 is not an integer value.

RELATED TAGS

isinteger
julia
method
communitycreator
RELATED COURSES

View all Courses

Keep Exploring