70 lines
2.4 KiB
Plaintext
70 lines
2.4 KiB
Plaintext
//-----------------------------------------------------------------------------
|
|
// Function types
|
|
//-----------------------------------------------------------------------------
|
|
test_function :: (thing: S64): *S64
|
|
function_type: test_function
|
|
const_function_alias :: test_function
|
|
// null_function: (t: S64): *S64 = null
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Booleans
|
|
//-----------------------------------------------------------------------------
|
|
Boolean: Bool = true
|
|
value_of_Bool: S64 = cast(Boolean: S64)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Nulls
|
|
//-----------------------------------------------------------------------------
|
|
// int_null: S64 = null
|
|
// str_null: String = null
|
|
// Bool_null: Bool = null
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Compound expressions
|
|
//-----------------------------------------------------------------------------
|
|
array1: [4]S64 = [4]S64(1,2,3,4)
|
|
array2 := [32]S64(1,2,3,4)
|
|
array3 := [32]S64(
|
|
[0] = 0,
|
|
[1] = 1,
|
|
[2] = 2,
|
|
[31] = 31,
|
|
)
|
|
array_item := array1[0]
|
|
array_item_imp: S64 = array2[2]
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Pointers
|
|
//-----------------------------------------------------------------------------
|
|
pointer_decl : *S64
|
|
variable_from_deref: S64 = *pointer_decl
|
|
pointer_from_var : *S64 = &variable_from_deref
|
|
Boolean_pointer := &Boolean
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Implicit type
|
|
//-----------------------------------------------------------------------------
|
|
implicit_int :: 10
|
|
implicit_str :: "Hello world"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Pointers
|
|
//-----------------------------------------------------------------------------
|
|
// pointer1: *S64 = 0
|
|
// pointer2: *S64 = pointer1
|
|
// pointer3: **S64 = 0
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// String types
|
|
//-----------------------------------------------------------------------------
|
|
string1 :: "Test"
|
|
string2 :: string1
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Constant S64 variables
|
|
//-----------------------------------------------------------------------------
|
|
thing0 :: 10
|
|
thing1 :: thing0 + 11
|
|
thing2 :: thing1 + 20
|
|
combin :: thing0 + thing1 + thing2
|