This repository was archived by the owner on Feb 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Variable Declarations
Nidin Vinayakan edited this page Mar 18, 2017
·
2 revisions
TurboScript supports let const and var variable declarations. let and var has same meaning in the current version, this may change in the future versions.
Declaring a variable in JavaScript has always traditionally been done with the var keyword.
var a = 10;As you might’ve figured out, we just declared a variable named a with the value 10. By default it will inferred as uint32 type (this might change to int32 in future).
We can also declare a variable inside of a function:
function f():uint32 {
var id:uint32 = 1;
return 1;
}const declarations are another way of declaring variables.
const numLivesForCat = 9;They are like let declarations but, as their name implies, their value cannot be changed once they are bound. In other words, they have the same scoping rules as let, but you can’t re-assign to them.