Variables
Declarations and assignment in GSET, and the Go var-first rule.
Declaring
Four keywords mean the same thing — GSET treats them identically:
var name = "Ada"
val count = 3
let ok = true
const pi = 3.14All four emit an appropriate declaration per target:
name = "Ada"
count = 3
ok = True
pi = 3.14let name = "Ada"
let count = 3
let ok = true
let pi = 3.14Assignment
A plain x = 42 re-assigns. In GSET this is a statement-level operation; it is a new declaration only in targets where = declares (Python, JavaScript).
var count = 1
count = count + 1
print(count)Built-in value types
| GSET | Python | JavaScript | Go |
|---|---|---|---|
"text" | "text" | "text" | "text" |
42 | 42 | 42 | 42 |
3.14 | 3.14 | 3.14 | 3.14 |
true / false | True / False | true / false | true / false |
null | None | null | nil |
[1, 2] | [1, 2] | [1, 2] | []interface{}{1, 2} |
{"a": 1} | {"a": 1} | {"a": 1} | map[string]interface{}{"a": 1} |
The Go "var first" rule
Go is the default IR, but Go requires a declared variable before assignment. This compiles and runs on the Go target:
var x = 42
print(x)This does not:
x = 42 -- go run → undefined: x
print(x)The same program is fine on Python and JavaScript. Rule of thumb for portable code: declare with var before first use. See Portability.
Type fidelity
GSET is dynamically typed by design. Unless you want Go output, you usually don't declare types:
var n = 5
var s = n * n
print(s)This generates valid Python/JS/Ruby, but Go would reject n * n on an interface{}. If you know the type, annotate it (see Functions for typed parameters):
var n int = 5Constants
const and val today behave exactly like var (no differing codegen per target beyond JavaScript's let). A true compile-time constant distinction is Planned.