Declaring variables

Now that you have seen how to declare variables, it's time to create a small program that demonstrates all the variable types in action.

currentScore as integer = 0
timeLeft as integer = 123
shipSpeed as float = 0.47
playerName as string = "player 1"

do print ( currentScore ) print ( timeLeft ) print ( shipSpeed ) print ( playerName ) sync ( ) loop

This program simply prints out the contents of the variables on screen.

image-1

Given that it's not necessary to explicitly declare integer variables our program could be modified to look like this.

currentScore = 0
timeLeft = 123
shipSpeed as float = 0.47
playerName as string = "player 1"

do print ( currentScore ) print ( timeLeft ) print ( shipSpeed ) print ( playerName ) sync ( ) loop

Either approach is perfectly acceptable.