70 lines
2.4 KiB
Plaintext
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
|