• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Loops
#6
Possibly the only good feature from Python is `for/else`. In pawn syntax:



PHP Code:
for (new 0!= 10; )

{

    if (
Something(i))

    {

        break;

    }

}

else

{

    
SomethingFailed();

}

// `break` jumps to here. 



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.
  Reply


Messages In This Thread
Loops - by Cubie - 2019-05-28, 12:49 PM
RE: Loops - by SyS - 2019-05-28, 02:12 PM
RE: Loops - by hual - 2019-05-28, 02:29 PM
RE: Loops - by Cubie - 2019-05-28, 02:33 PM
RE: Loops - by hual - 2019-05-28, 02:38 PM
RE: Loops - by Y_Less - 2019-05-28, 03:01 PM
RE: Loops - by Stanislav - 2019-05-28, 09:00 PM
RE: Loops - by JustMichael - 2019-05-28, 09:02 PM
RE: Loops - by Y_Less - 2019-05-28, 11:28 PM

Forum Jump: