Navigation
Synopsis Determine the number of elements in a list.
Function int size(list[&T] lst)
Usage import List;
Examples
rascal>import List;
ok
rascal>size([20, 10, 30]);
int: 3
rascal>size(["zebra", "elephant", "snake", "owl"]);
int: 4

Questions
Question [1]. Create a list of the right size.
Fill in
import List;
list[str] text = ;
and make the following true:
size(text) == 3;

Question [2]. Determine the number of elements in a list
Given
import List;
text = ["abc", "def", "ghi"];
(text) == 3;



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.