mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-05-06 00:40:11 +10:00
Implemented array.forEach(fn)
This commit is contained in:
+8
-15
@@ -1,18 +1,11 @@
|
||||
|
||||
fn output(arg) {
|
||||
print arg;
|
||||
}
|
||||
|
||||
var array = ["alpha", "bravo", "charlie"];
|
||||
|
||||
|
||||
var table: Table = ["answer":42];
|
||||
|
||||
print table.hasKey("answer");
|
||||
print table.hasKey("question");
|
||||
|
||||
table.insert("question", "roads");
|
||||
|
||||
print table.hasKey("answer");
|
||||
print table.hasKey("question");
|
||||
|
||||
table.remove("answer");
|
||||
|
||||
print table.hasKey("answer");
|
||||
print table.hasKey("question");
|
||||
|
||||
|
||||
array.forEach(echo);
|
||||
array.forEach(output);
|
||||
Reference in New Issue
Block a user