The length()
function in Euphoria is used to return the size of a sequence.
The sequence length depends on how many members the sequence has and the number of whitespaces it includes.
length(my_seq)
my_seq
: This is the sequence variable whose size needs to be determined.This function returns an atom, which is the length of the sequence.
The code written below returns the size of the sequence.
--declare atom variablesatom an_atom1, an_atom2, an_atom3--check the length of different variablesan_atom1 = length({0,1,2,3,4,5,6,7,8,9})an_atom2 = length({{1,2}, {3,4}, {5,6}})an_atom3 = length("I am going to win it")--print the result to outputprint(1,an_atom1)puts(1,"\n")print(1,an_atom2)puts(1,"\n")print(1,an_atom3)
length()
method on the sequence and hold the return value in the assigned value.printf()
method.puts()
methods is used to print new lines.