Opera Ghost Language
Jump to navigation
Jump to search
[] means optional, () means can be modified according to the programmer
Variables and constants:
1. To declare a variable:
let [(type)] (name) be (value), Ex: let num be 1
2. If you do not want to initialize the variable, you can do this:
let [(type)] (name) be your freedom, Ex: let toinput be your freedom
3. To define constants:
let [(type)] (name) as unchanging as the sea be (value), Ex: let c as unchanging as the sea be 299792458
4. Getting the address of a variable:
where in the world has (variable) been hiding
5. Dereferencing pointer:
what has (pointer) to hide or angel or father friend or phantom who is it at (pointer)
1D Arrays:
1. Creating an array:
let [(type)[(length)]] (array_name) be (value) and (value) and ... in one combined
2. Setting value at index:
(value) shall watch the performance from its normal seat in (array) (index)
nD Arrays (Ex. 2D array):
1. Creating an array:
let [(type)[(length)][(length)]] (array_name) be ((value) and (value) and ... in one combined) and ((value) and (value) and ... in one combined) and ... in one combined
2. Setting value at index:
(value) shall watch the performance from its normal seat in (array) (index) (index)
structs:
1. Creating a struct (the type is optional if the compiler can deduce the type of (default_value)):
let the opera (struct_name) begin cast (default_value) as (type) (member1_name) cast (default_value) as (type) (member2_name) ... it's over now the opera (struct_name) let (struct_name) (variable_name) be (value) and (value) and ... in one combined
2. Creating an anonymous struct:
let [type1 and type2 and ...] (struct_name) be (name) is (value) and (name) is (value) and ... in one combined