How did I forget something so basic?

This commit is contained in:
2022-09-07 19:32:43 +01:00
parent 28b1b8e2cc
commit 8d8928438d
5 changed files with 135 additions and 11 deletions

View File

@@ -50,4 +50,15 @@
}
//test indexing with variables
{
var week = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
var first = 1;
var second = 2;
var third = -1;
assert week[first:second:third] == ["wednesday", "tuesday"], "indexing with variables failed";
}
print "All good";

View File

@@ -50,4 +50,13 @@
}
//test indexing with variables
{
var d = ["one":1, "two":2, "three":3];
var first = "two";
assert d[first] == 2, "indexing with variables failed";
}
print "All good";

View File

@@ -29,4 +29,12 @@ numbers[::-2] = "abc";
assert numbers == "01234c6b8a", "string weird manipulation failed";
//test indexing with variables
var first = 11;
var second = 15;
var third = -1;
assert greeting[first:second:third] == "dlrow", "indexing with variables failed";
print "All good";