Skip to content

Expression Definitions

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Expression Definitions

Expressions can be given a name using the define

define PI = 3.14159265

TAU :: define = 6.2831853

Alternative Legacy Syntax (Only for global expression definitions)

ROOT2 == 1.4142135

Reevaluation

Since expressions definitions just attach a name to an expression, the expression is reevaluated in context each time it's used.

import basics

define COUNTER = getNextCount()

func main {
    print(COUNTER)
    print(COUNTER)
    print(COUNTER)
}

func getNextCount() int {
    static counter int = 0
    return counter++
}
0
1
2
Clone this wiki locally