-
Notifications
You must be signed in to change notification settings - Fork 80
Syntax and coding style
Paolo Angeli edited this page Sep 21, 2019
·
27 revisions
Some comments
// Simple one line comment
/* Multi line comment */
/* A strange /* nested */ comment */
Some constants
RED::0x04586;
PI::3.14;
PLAYER::"Unnamed";
Some variables
counter : int;
mode := 10;
area : float = r * r * PI;
Some procedures
main_loop(){
while 1 {
get_user_input();
simulate();
render();
post_process();
}
}
do_something :: (what: string){
printf("I'm doing: %", what);
}
Some functions
square :: (val: float) -> float {
return val * val;
}
circle_area:: (radious: float) -> float {
return radious * radious * PI;
}
Some aggregated data type usage
Spring :: struct {
relaxed_length : float; // millimeters
theta : float; // N/m
force : float; // N
current_length : float; // mm
}
a_spring: Spring;
using a_spring {
relaxed_length := 100;
theta := 1000.0;
force := 25;
current_length = theta / relaxed_length * force + relaxed_lenght;
}
These documents were verified using Grammarly free browser plugin for Chrome. Please use some spell checker before submitting new content.
- Variables and assignments
- Language data types
- Simple user-defined data types
- Expressions and operators
- Type-casting
- Pointers
- Declarations
- Arguments / Parameters
- Return values
- Overloading / Polymorhism
- Advanced features
- Lambdas
- Arrays
- Strings
- Composition of Structs
- Metaprogramming
- Templates / Generics