Integers in Trillium
The int data type can store whole numbers from -2147483648 to 2147483647. In general the int data type is the preferred data type when we create variables with a numeric value.
Below will show you how integers are handled in Trillium and how you can define integers.
Below will show you how to declare integers
Above you can see how to first create a integer variable by defining 'var someNum' and setting it equal to 13. You can also define a integer implicitly by using the ' : int ' nomenclature.
Ints have a wide variety of use as they can be the result against other variable types like strings. It is recommended to look at the calculator example to see integers. Below is a video of this method being made as well.
You can see above some common uses for ints in Trillium. Of course this is a basic example and other use cases can and do exist.
Casting to a Integer
Depending on the return type a method uses it won't always return an int, but rather a string of an int like '1337', so you need to cast this to a int.
If you pass the string '1337' to the method above it will return a int value of 1337