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:
# Julia Program for illustration of # checkindex() function # Initializing a range value from 1 to 10 Range = 1 : 10
# Initializing a index value of 5 Index = 5
# Calling the checkindex() function A = checkindex( Bool , Range , Index)
# Getting the value true or false println(A) |
Output:
true
Example #2:
# Julia Program for illustration of # checkindex() function # Initializing a range value from 1 to 10 Range = 1 : 10
# Initializing a index value of 15 Index = 15
# Calling the checkindex() function A = checkindex( Bool , Range , Index)
# Getting the value true or false println(A) |
Output:
false
Article Tags :
Recommended Articles