There are 2 ways of declaring a variable in Nu. The standard variable definition, and the variable defining (only the first one works in package scope).

var def

with the keyword var followed by the variable name and optionally its type and an assignment. It needs at least one of the two (type or assignment). It is possible to declaring multiple variable with one var keyword, by separating the declaration by a coma ,. It is possible to “apply” the type to all variable previously untyped (and without a value).

// example

var a int // simple variable declaration
var a, b int // a and b will be typed int

var a, b int, c = 42,
	d float = 31, e string