Alternative variable declarations

There is an alternative method of declaring variables as floats and strings. Instead of using the as float or as string keywords you can instead use # and $. Here's some examples of the alternative method for declaring some floating point variables.

shipSpeed# = 5.8
shipRotationSpeed# = 1.3

Now we can see the alternative method for declaring string variables.

playerName$ = "player 1"

The additional symbols at the end of the variable name are used to identify the variable types and become part of the variable name. If you want to reference these variables later on be sure to include the symbols on the end. This example shows the variables being declared and printed on screen.

shipSpeed# = 5.8
shipRotationSpeed# = 1.3
playerName$ = "player 1"

do print ( shipSpeed# ) print ( shipRotationSpeed# ) print ( playerName$ ) sync ( ) loop

Whether you declare variables using the as keyword or go for the alternative method is your choice. Ideally it's best to stick with one method and use that throughout your programs. This will help to ensure your code is consistent.