{"name":"do","operator":null,"title":"do","type":"command","url":"https://community.bistudio.com/wiki/do","revid":311159,"updated":"2022-05-11T13:17:42Z","groups":["Program Flow"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.85"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.85"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Executes *code*. Used as part of a construct, such as while, with, for and switch. The *code* is always executed in missionNamespace unless do is used with with as an argument.","syntaxes":[{"syntax":"construct do code","since":null,"effect":null,"exec":null,"params":[{"name":"construct","type":null,"optional":false,"default":null,"description":"While Type (while), With Type (with), For Type (for), Switch Type (switch)","types":["While Type","while","With Type","with","For Type","for","Switch Type","switch"],"since":null,"text":"construct: While Type (while), With Type (with), For Type (for), Switch Type (switch)"},{"name":"code","type":"Code","optional":false,"default":null,"description":null,"types":["Code"],"since":null,"text":"code: Code"}],"returns":{"type":"Anything","types":["Anything"],"description":null,"text":"Anything"},"form":"binary","operator":null,"left":{"text":"construct","types":["While Type","while","With Type","with","For Type","for","Switch Type","switch"]},"right":{"text":"code","types":["Code"]}}],"examples":[{"text":"```sqf\nwhile { b > a } do\n{\n    a = a + 1;\n};\n```","code":["while { b > a } do\n{\n\ta = a + 1;\n};"]},{"text":"```sqf\nwith uiNamespace do\n{\n    MyUIVar = MyUIVar + 5;\n};\n```","code":["with uiNamespace do\n{\n\tMyUIVar = MyUIVar + 5;\n};"]},{"text":"```sqf\nfor \"_i\" from 1 to 10 do\n{\n    systemChat str _i;\n    sleep 0.5;\n};\n```","code":["for \"_i\" from 1 to 10 do\n{\n\tsystemChat str _i;\n\tsleep 0.5;\n};"]},{"text":"```sqf\nswitch (50) do\n{\n    case 25: { hint \"25\" };\n    case 50: { hint \"50\" }; // hints \"50\"\n    case 75: { hint \"75\" };\n    default { hint \"nope\" };\n};\n```","code":["switch (50) do\n{\n\tcase 25: { hint \"25\" };\n\tcase 50: { hint \"50\" }; // hints \"50\"\n\tcase 75: { hint \"75\" };\n\tdefault { hint \"nope\" };\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Control Structures"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Program Flow","Introduced with Operation Flashpoint version 1.85","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}