Getting last element of an array in Julia - last() Method Last Updated : 26 Mar, 2020 Comments Improve Suggest changes Like Article Like Report 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 to illustrate # the use of last() method # Getting the last element of # the specified iterable collection # or 1D array println(last(1:2:3)) println(last(5:10)) println(last([3, 5, 7, 9])) println(last([2, 4, 6, 8])) Output: 3 10 9 8 Example 2: Python # Julia program to illustrate # the use of last() method # Getting the last element of # the specified 2D and 3D array println(last([3 5; 7 9])) println(last(["a" "b"; "c" "d"])) println(last(cat([1 2; 3 4], [5 6; 7 8], [2 2; 3 4], dims = 3))) println(last(cat(["a" "b"; "c" "d"], ["e" "f"; "g" "h"], ["i" "j"; "k" "l"], dims = 3))) Output: Comment More infoAdvertise with us Next Article Getting last element of an array in Julia - last() Method K Kanchan_Ray Follow Improve Article Tags : Julia Similar Reads Getting first element of an array in Julia - first() Method 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 progr 1 min read Getting last index of a collection in Julia - lastindex() Methods The lastindex() is an inbuilt function in julia which is used to return the last index of the specified collection. If a dimension d is given, return the last index of collection along dimension d. Syntax: lastindex(collection) or lastindex(collection, d) Parameters: collection: Specified collection 1 min read Get number of elements of array in Julia - length() Method The length() is an inbuilt function in julia which is used to return the number of elements present in the specified array. Syntax: length(A::AbstractArray) Parameters: A: Specified array Returns: It returns the number of elements present in the specified array. Example 1: Python # Julia program to 2 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 maximum elements in Julia - maximum() and maximum!() Methods The maximum() is an inbuilt function in julia which is used to return maximum elements in different scenario. Syntax: maximum(f, itr) or maximum(itr) or maximum(A::AbstractArray; dims) Parameters: f: Specified function.itr: Specified list of elements.A::AbstractArray: Specified array of different d 2 min read Like