Fix scripts and tests.

This commit is contained in:
Stephen Chung 2020-06-27 21:19:53 +08:00
parent 549ef6bf7f
commit f3bde843cb
3 changed files with 36 additions and 36 deletions

View File

@ -12,6 +12,6 @@ for a in arr {
//print(a); // <- if you uncomment this line, the script will fail to run //print(a); // <- if you uncomment this line, the script will fail to run
// because 'a' is not defined here // because 'a' is not defined here
for i in range(0, 5) { // runs through a range from 1 to 5 exclusive for i in range(0, 5) { // runs through a range from 0 to 4
print(i); print(i);
} }

View File

@ -10,8 +10,8 @@ print("foo" < "bar"); // string comparison
print("foo" >= "bar"); // string comparison print("foo" >= "bar"); // string comparison
print("the answer is " + 42); // string building using non-string types print("the answer is " + 42); // string building using non-string types
let s = "hello, world!"; // string variable let s = "\u2764" hello, world! \U0001F603"; // string variable
print("length=" + s.len); // should be 13 print("length=" + s.len); // should be 17
s[s.len-1] = '?'; // change the string s[s.len-3] = '?'; // change the string
print("Question: " + s); // should print 'Question: hello, world?' print("Question: " + s); // should print 'Question: hello, world?'