assignments and basic types

Assignments and types

An assignment is made with = as in

x = expr;

At runtime, expr is the object that represents the evaluation of an expression, and it’s being referenced by x. At compile-time, x must be an sub-type of expr
Assignments can be also done at variable declarations, and the type of the variable will be the compile-time type of expr

var x = expr;

Cyan has one basic type, starting with an upper case letter, for each of the basic types of Java: Byte, Short, Int, Long, Float, Double, Char, and Boolean. Besides that, there are prototypes Nil and String, also considered basic types.
There are special ways to define literals for some basic types. Cyan literals of the basic types are defined as those of Java. Byte, Short, and Long literals should end with B or Byte, S or Short, and L or Long, respectively as in

var aByte = 7B;
var aShort = 29Short;
var aLong = 1234567L;
var bLong = 37Long;
var anInt = 223Int;

Integral literal numbers without a postfixed letter are considered as having type Int. Numbers with a dot such as 10.0 as considered as Double´s. Float literals can end with F or Float. Double literals should end with D or Double. There is no automatic conversion between types:

var Int age;
var Byte byte0;
var Float height;
var Double width;