mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Found a compiler bug, thanks Aedan!
This commit is contained in:
27
scripts/example.toy
Normal file
27
scripts/example.toy
Normal file
@@ -0,0 +1,27 @@
|
||||
var colors = [
|
||||
"red",
|
||||
"orange",
|
||||
"yellow",
|
||||
"green",
|
||||
"blue",
|
||||
"violet",
|
||||
"indigo"
|
||||
];
|
||||
|
||||
fn getRainbowColor(index) {
|
||||
return colors[index];
|
||||
}
|
||||
|
||||
|
||||
import standard;
|
||||
import random;
|
||||
|
||||
var rng: opaque = createRandomGenerator(hash(clock()));
|
||||
|
||||
|
||||
|
||||
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
||||
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
||||
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
||||
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
||||
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
||||
Reference in New Issue
Block a user