Getting first element of an array in Julia - first() Method Last Updated : 26 Mar, 2020 Comments Improve Suggest changes Like Article Like Report The first() is an inbuilt function in julia which is used to return the first element of the specified iterable collection. Syntax: first(coll) Parameters: coll: Specified iterable collection. Returns: It returns the first element of the specified iterable collection. Example 1: Python # Julia program to illustrate # the use of first() method # Getting the first element of # the specified iterable collection # or 1D array println(first(1:2:3)) println(first(5:10)) println(first([3, 5, 7, 9])) println(first([2, 4, 6, 8])) Output: 1 5 3 2 Example 2: Python # Julia program to illustrate # the use of first() method # Getting the first element of # the specified 2D and 3D array println(first([3 5; 7 9])) println(first(["a" "b"; "c" "d"])) println(first(cat([1 2; 3 4], [5 6; 7 8], [2 2; 3 4], dims = 3))) println(first(cat(["a" "b"; "c" "d"], ["e" "f"; "g" "h"], ["i" "j"; "k" "l"], dims = 3))) Output: Comment More infoAdvertise with us Next Article Getting first element of an array in Julia - first() Method K Kanchan_Ray Follow Improve Article Tags : Julia Similar Reads Getting last element of an array in Julia - last() Method The last() is an inbuilt function in julia which is used to return the last element of the specified iterable collection. Syntax: last(coll) Parameters: coll: Specified iterable collection. Returns: It returns the last element of the specified iterable collection. Example 1: Python # Julia program t 1 min read Getting first and last set of elements in Julia - front() and tail() Methods The front() is an inbuilt function in julia which is used to return a tuple consisting of all but the last component of x, where x is the specified tuple. Syntax: front(x::Tuple)::Tuple Parameters: x::Tuple: Specified tuple. Returns: It returns a tuple consisting of all but the last component of x, 2 min read Getting first index of a collection in Julia - firstindex() Methods The firstindex() is an inbuilt function in julia which is used to return the first index of the specified collection. If a dimension d is given, return the first index of collection along dimension d. Syntax: firstindex(collection) or firstindex(collection, d) Parameters: collection: Specified colle 1 min read Get index of first true value of array in Julia | Array findfirst() Method The findfirst() is an inbuilt function in julia which is used to return the index or key of the first true value in the specified array. Here values of index or key start from 1 i.e, for index of 1st element is 1, index of 2nd element is 2 and so on. Syntax: findfirst(A) or findfirst(predicate::Func 2 min read Getting data type of elements in Julia - typeof() Method The typeof() is an inbuilt function in julia which is used to return the concrete type of the specified elements. Syntax: typeof(x) Parameters: x: Specified element. Returns: It returns the concrete type of the specified elements. Example 1: Python # Julia program to illustrate # the use of typeof() 1 min read Like