Types

Claro is a statically typed, compiled programming language. This means that if you attempt to assign a value of the wrong type to a variable, Claro will emit a compiler error asking for a correction before your program will be able to run. This will prevent you from waiting until runtime to find many program errors.

Fig 1:


var s: string = 100.55;

Compilation Errors:

static_typing_EX1_example.claro:1: Invalid type:
	Found:
		double
	Expected:
		string
var s: string = 100.55;
                ^^^^^^
1 Error