Julia | checkindex() function with examples
Last Updated :
06 Mar, 2020
The checkindex()
is an inbuilt function in julia which is used to return true if the given index value lies within the range, otherwise returns false.
Syntax: checkindex(Bool, Range, Index)
Parameters: This function accepts three parameters which are illustrated below:-
- Bool: This says that this function will return boolean values as output.
- Range: It is the specified range.
- Index: It is the index value which are going to be calculated either it lies in the range or not.
Returns: It returns the value true if the index value lies in the range else false.
Below are some codes which illustrate the above function:
Example #1:
Range = 1 : 10
Index = 5
A = checkindex( Bool , Range , Index)
println(A)
|
Output:
true
Example #2:
Range = 1 : 10
Index = 15
A = checkindex( Bool , Range , Index)
println(A)
|
Output:
false
Share your thoughts in the comments
Please Login to comment...