To ; or not to ; that is the question! Simple answer is, if in doubt, do it. Let me explain. Semicolon is used in SQF scripts to tell the engine where one command ends and another starts. If you miss ; where it is required the script will abort and write an error message to .rpt file, telling you that you missed a semicolon.

a = b; c = d; //ok a = b c = d; //error a = {c = d;}; //ok a = {c = d}; //also ok

You may omit the last semicolon before closing code bracket } since it is the end of the code scope. You can also omit semicolon on the very last line of the code for the same reason, end of file is the end of the code scope. Really it wouldn’t hurt if you put extra semicolon even if you don’t have to.

while {true} do {hint "ok"; breakOut ""} //fine while {true;} do {hint "ok too"; breakOut "";}; //also fine

But be careful when passing arguments, extra semicolon could be a code breaker.

a = {"ok"}; hint format ["%1",call a;]; //error a = {"ok"}; hint format ["%1",call a]; //much better

Same goes for (). Parentheses are used to tell the engine the order in which it has to process expression. The most inner expression is processed first, then its parent, then grandparent and so on (((1) 2) 3). For example, you want to select array within array. (EDIT: With select statement you can omit () in some simple cases: _eight = _array select 3 select 4 select 0; works just fine.)

_array = [1,2,3,[4,5,6,7,[8,9]]]; _eight = ((_array select 3) select 4) select 0;

You can achieve the same result as above by using  intermediate variables:

_array1 = _array select 3; _array2 = _array1 select 4; _eight = _array2 select 0;

Use parentheses generously to logically separate ArmA commands or you might face some unpredictable results. Compare the following expressions.

//INCORRECT {diag_log format ["%1",_x]} forEach position player nearObjects 50; //CORRECT {diag_log format ["%1",_x]} forEach ((position player) nearObjects 50);

Although the first expression does not result in error, the actual output result is a few random numbers and is not what is expected. What expected is a list of objects within 50 metres of player position and second expression does exactly that, thanks to parentheses.

Ah well, might as well mention how to call a function in the same post. But first you have to make one and it is pretty straight forward as function is nothing more but a variable with a code assigned to it. Variable could be either private or public. To call a function you can use call command (more about other commands later).

my_function = { a = 1; b = 2; c = a + b; }; call my_function; //c is now 3

Functions can take arguments as well as return results. To pass arguments to a function using call command, precede it with a variable containing arguments. If you have multiple arguments you can pass array. Passed arguments will get assigned to special variable _this inside the function. To pass the result back from function you will need to end the code with a single variable or unassigned expression.

//either my_function = { private ["_a","_b","_c"]; _a = _this select 0; _b = _this select 1; _c = _a + _b; _c }; //or my_function = { (_this select 0) + (_this select 1) }; _result = [1,2] call my_function; //_result is 3

Note the use of parentheses in second example, it simply will not work without. This is it for the basics, hope it helps.