Rosetta Code
Rosetta Code Arrays
Demonstrate basic array creation, indexing, appending, and aggregation in Vibescript.
Source
rosettacode/popular/arrays.vibe
# title: Arrays
# source: https://rosettacode.org/wiki/Arrays
# category: Rosetta Code
# difficulty: Intro
# summary: Demonstrate basic array creation, indexing, appending, and aggregation in Vibescript.
# tags: popular, arrays, basics, collections
# vibe: 0.4
def run
values = [3, 1, 4]
expanded = values.dup.push(1, 5, 9)
{
original: values,
expanded: expanded,
first: expanded.first,
last: expanded.last,
count: expanded.size,
total: expanded.sum
}
end
Output
Press run to execute run from this example.