phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
22
examples/array_plugin_demo.hako
Normal file
22
examples/array_plugin_demo.hako
Normal file
@ -0,0 +1,22 @@
|
||||
// ArrayBox plugin demo
|
||||
// Requires: plugins/nyash-array-plugin built (release) and nyash.toml updated
|
||||
// Run:
|
||||
// NYASH_CLI_VERBOSE=1 ./target/release/nyash --backend vm examples/array_plugin_demo.hako
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local a, i
|
||||
a = new ArrayBox()
|
||||
// push integers 1..5
|
||||
i = 1
|
||||
loop (i <= 5) {
|
||||
a.push(i)
|
||||
i = i + 1
|
||||
}
|
||||
me.console.log("len=", a.length())
|
||||
me.console.log("get(0)=", a.get(0))
|
||||
me.console.log("get(4)=", a.get(4))
|
||||
return a.length()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user