Type casting is working:

This commit is contained in:
2022-08-19 19:24:07 +01:00
parent 9365541c8f
commit 4f0aebc32f
9 changed files with 236 additions and 25 deletions

30
scripts/casting.toy Normal file
View File

@@ -0,0 +1,30 @@
//boolean origin
var b: bool = true;
print (int)b;
print (float)b;
print (string)b;
//integer origin
var i: int = 42;
print (bool)i;
print (float)i;
print (string)i;
//float origin
var f: float = 3.14;
print (bool)f;
print (int)f;
print (string)f;
//string origin
var s: string = "78.9";
print (bool)s;
print (int)s;
print (float)s;

View File

@@ -1,6 +0,0 @@
var arr : [int] = [1, 2, 3, 42];
var dict : [string, int] = ["hello": 1, "world":2];
print arr;
print dict;