The isassigned()
is an inbuilt function in julia which is used to test whether the given index contains a value in the specified array or not.
Syntax: isassigned(array, i)
Parameters:
- array: Specified array
- i: Specified index value
Returns: It returns true if the specified index value is present in the array else false.
Example 1:
A = [ 5 , 10 , 15 , 20 ]
println(isassigned(A, 3 ))
B = [ 5 10 ; 15 20 ]
println(isassigned(B, 5 ))
C = cat([ 1 2 ; 3 4 ], [ 5 6 ; 7 8 ],
[ 9 10 ; 11 12 ], dims = 3 )
println(isassigned(C, 9 ))
|
Output:

Example 2:
A = [ 1 , 2 , 3 ];
println(isassigned(A, 10 ))
B = [ 5 10 ; 15 20 ; 25 30 ];
println(isassigned(B, 25 ))
C = cat([ 1 2 ; 3 4 ], [ 5 6 ; 7 8 ],
[ 9 10 ; 11 12 ], [ 13 14 ; 15 16 ], dims = 3 );
println(isassigned(C, 9 ))
|
Output:
