Files
corelang/globals.kl
Krzosa Karol 9a58e407a4 Remove null
2022-06-02 09:59:12 +02:00

70 lines
2.4 KiB
Plaintext

//-----------------------------------------------------------------------------
// Function types
//-----------------------------------------------------------------------------
test_function :: (thing: int): *int
function_type: test_function
const_function_alias :: test_function
// null_function: (t: int): *int = null
//-----------------------------------------------------------------------------
// Booleans
//-----------------------------------------------------------------------------
boolean: bool = true
value_of_bool: int = cast(boolean: int)
//-----------------------------------------------------------------------------
// Nulls
//-----------------------------------------------------------------------------
// int_null: int = null
// str_null: String = null
// bool_null: bool = null
//-----------------------------------------------------------------------------
// Compound expressions
//-----------------------------------------------------------------------------
array1: [4]int = [4]int(1,2,3,4)
array2 := [32]int(1,2,3,4)
array3 := [32]int(
[0] = 0,
[1] = 1,
[2] = 2,
[31] = 31,
)
array_item := array1[0]
array_item_imp: int = array2[2]
//-----------------------------------------------------------------------------
// Pointers
//-----------------------------------------------------------------------------
pointer_decl : *int
variable_from_deref: int = *pointer_decl
pointer_from_var : *int = &variable_from_deref
boolean_pointer := &boolean
//-----------------------------------------------------------------------------
// Implicit type
//-----------------------------------------------------------------------------
implicit_int :: 10
implicit_str :: "Hello world"
//-----------------------------------------------------------------------------
// Pointers
//-----------------------------------------------------------------------------
// pointer1: *int = 0
// pointer2: *int = pointer1
// pointer3: **int = 0
//-----------------------------------------------------------------------------
// String types
//-----------------------------------------------------------------------------
string1 :: "Test"
string2 :: string1
//-----------------------------------------------------------------------------
// Constant int variables
//-----------------------------------------------------------------------------
thing0 :: 10
thing1 :: thing0 + 11
thing2 :: thing1 + 20
combin :: thing0 + thing1 + thing2