main
function
The type and parameter of the main function are optional, the shortest main function is main(){}
. The parameters of the main function can be used to declare variables:
main(argv,b){b=1;…}
// or
main(argv,{b=1}){…}
// instead of
main(argv){var b=1;…}
main({a,b,c=0}){…}
// instead of
main(){var a,b,c=0;…}
Other tips
- The
~/
operator performs integer division
- The spread operator (
...
) can insert multiple values into a collection
- Use control-flow operators:
[for(int i=1;i<100;i++)if(i%2<1)i] // even numbers below 100
- If you need an empty array on a hole without arguments, you can use the argv variable