Declarations and statements
var x T,var x T = e— explicit type;x := e— inferred frome(untyped constants default toint/float);nilcannot initialise:=.- Package-level
constonly; package-levelvarisAES1105. State lives in script fields and components. - Functions have fixed arity and zero or one result. A function that declares a result must end in a terminating statement (
AES2013). Recursion is allowed up to depth 256. if,if … else if … else;for cond {},for init; cond; post {},for {};break,continue.switch x { case a, b: … default: … }— no fallthrough; aswitchon an enum must cover every member or have adefault(AES2015); duplicate cases are errors.- Compound assignment
+= -= *= /= %=and++/--onint/floatlvalues; lvalues are variables, fields, lanes, slice elements, component fields and fields reached through aScriptRef. - A statement-level expression must be a call; an unused value is an error. Discarding the result of
len,append, a conversion,Get<T>,GetScript<T>orConnectis an error. Discarding the result ofstartis allowed. - Unused local variables are warnings.
- There are no closures, lambdas, defer, goroutines, pointers or maps.