{"name":"else","title":"else","type":"command","url":"https://community.bistudio.com/wiki/else","revid":364827,"updated":"2024-06-16T09:33:24Z","groups":["Program Flow"],"status":"ok","games":{"ofp":"1.85","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.85","arma3_since":"0.50","description":"Executes else code when if condition returns false.","syntaxes":[{"syntax":"thenCode else elseCode","params":[{"name":"thenCode","type":"Code","type_expr":"Code"},{"name":"elseCode","type":"Code","type_expr":"Code"}],"returns":{"type":"Array","type_expr":"Array","description":"with [thenCode, elseCode]\n- thenCode: Code - elseCode: Code","text":"Array with [thenCode, elseCode]\n\n- thenCode: Code\n- elseCode: Code"},"form":"binary","left":{"text":"thenCode"},"right":{"text":"elseCode"}}],"examples":[{"code":["if (a > b) then { c = 0 } else { c = 1 };"]},{"text":"```sqf\nif (a < b) then {\n    hint \"B is greater than A\";\n} else {\n    hint \"A is greater than B\";\n};\n```","code":["if (a < b) then {\n\thint \"B is greater than A\";\n} else {\n\thint \"A is greater than B\";\n};"]}],"see_also":["Control Structures","if","then"]}