if(something) |
I thought of using a proc, but it's not really the best choice for something that is only used once right there in the code.
A universal proc wouldn't work either, because in the places I'm using this, the code is quite different.
I was thinking maybe a goto statement, but I'm looking into that.
Just posting this so I could get an idea of what you guys would do.
EDIT: Found a fix that gave me an outcome I liked.
label |
The first way will cause an infinite loop until something is true, which in my case was the outcome I liked, and I think it could be replaced with a while loop that uses the sleep proc. The second one doesn't cause a loop, and can cause the wanted result, but not the way I wanted it to, strangely.
Do you think it's a justified use of the goto statement?
A very quick workaround you could do, if the side effects are no bother, is:
(the more condensed, less clear, un-var-modifying version would be:)
Of course, like I said, remember your spawn()ed code will only run once the current proc either finishes or encounters a sleep()-like instruction, so it's not exactly the same as porting the code to a proc would be. Of course, you could stick a sleep() (empty arg, or null) directly afterwards to make it run, but that obviously has natural disadvantages to your proc, well, depending on what it does. Naturally.
EDIT: Since I don't really know what you're doing, if I used goto, I'd do it simply like this more efficient way:
As for being justified use of goto, I'm not really sure. Perhaps you can manage with using sleep() to delay the proc itself in this manner?
If that happens to be suitable for what you're trying to do, that'd be the better approach.