In Euphoria, the tail()
function is used to return members of a sequence beginning from the end of the sequence, with the length of the member returned, depending on the number indicated.
tail(any_sequence,tail_size)
any_sequence
: This is the sequence we wish to get the tail
value. It can be of any sequence type.tail_size
: With this parameter, we can indicate the size of the returned tail
value. It can be zero. If it is more than the size of the sequence, the whole sequence will be returned. This parameter is of type integer.First, the parser checks the function for the indicated sequence and size it will return from the rightmost part including whitespaces.
So, the return value is going to be a sequence containing the tail
value.
tail
is to be returned and the size of the tail
value we wish to return.
And that is it you can use the return value any way we want to.The code below shows how the tail
of certain sequences is saved as a value of the variables seq1
, seq2
, and seq3
.
sequence seq1, seq2, seq3 seq1 = tail({1,3,5,7}, 0) seq2 = tail("John Doe", 4) seq3 = tail("Marathon", 20) print(1,seq1) printf(1," \n %s \n %s ",{seq2,seq3})
seq1
, seq2
, and seq3
.tail
value of certain sequences returned by the tail()
function.print
and printf
methods to print the output.From the output, we can see how seq1
returns as an empty sequence, because the tail_size
parameter supplied is 0
.
RELATED TAGS
CONTRIBUTOR
View all Courses