Appearance
Lists & Standard Input
Lists
Creating Lists
Create a populated list with list of ... end (element type is inferred from the first element and checked across all elements):
text
let fruits be list of say apple end and say banana end end
let scores be list of 40 and 78 and 95 endCreate an empty typed list with empty list of <type>:
text
let evens be empty list of numIndexing, Mutating, Appending & Length
text
note read element at index 0
let first be item 0 of fruits
note update element at index 1
set item 1 of fruits to say blueberry end
note append to end of list
append say cherry end to fruits
note get length (works on both lists and text)
let n be length of fruitsPassing Lists to Functions
text
fn sumlist with list of num nums returns num do
let total be 0
for each n in nums do
set total to total plus n
end
give back total
endStandard Input (ask)
Prompt the user and read a line from standard input using ask:
text
import print
import text
ask say Enter your name end into name
ask num say Enter your birth year end into year
let age be 2026 minus year
let loud be upper of text contains name
ln of print contains say Hello end and loud and say you are about end and age and say years old endask <prompt> into <var>reads atextline.ask num <prompt> into <var>reads a line and parses it as anum(int64, defaulting to0on invalid input).- If
<var>does not exist yet in the current scope,askdeclares it automatically; if it already exists,askverifies the type matches and reassigns it.