[Pawn] Loops - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] Loops (/showthread.php?tid=612) |
Loops - Cubie - 2019-05-28 Is there actually a way to check if a loop is finished? I'm going to try to explain. e.g loop: PHP Code: foreach (new i : Player) e.g what I wonder: PHP Code: [Loop Finishes] If anybody knows a fancy other trick that is fine too off course. Thanks in advance. RE: Loops - SyS - 2019-05-28 When a loop finishes the code outside its block gets executed. Code: for(.....) { RE: Loops - hual - 2019-05-28 pawn is synchronous so any code under your loop will be executed after the loop RE: Loops - Cubie - 2019-05-28 Oh Sweet! All I had to know Thanks guys! RE: Loops - hual - 2019-05-28 Oh, and if you want to actually end a loop prematurely without exiting the function, use break, not return: https://wiki.sa-mp.com/wiki/Control_Structures#break RE: Loops - Y_Less - 2019-05-28 Possibly the only good feature from Python is `for/else`. In pawn syntax: PHP Code: for (new i = 0; i != 10; ) The `else` block is only run if the loop exited without calling `break`, i.e. ended normally. I'm sure there's a way to fake or mimic it. RE: Loops - Stanislav - 2019-05-28 (2019-05-28, 03:01 PM)Y_Less Wrote: Possibly the only good feature from Python is `for/else`. ?In pawn syntax: Im sorry if im deviating the topic but, why "the only good feature"? RE: Loops - JustMichael - 2019-05-28 (2019-05-28, 09:00 PM)Stanislav Wrote:(2019-05-28, 03:01 PM)Y_Less Wrote: Possibly the only good feature from Python is `for/else`. ?In pawn syntax: He meant the only good feature that can translate to pawn and be useable (I think that's what he meant) RE: Loops - Y_Less - 2019-05-28 I don't actually know Python well enough to say that's the only good feature, nor even what I meant which was more "good unique feature". |