GO TO? JUMP? [Solved]
|
11-25-2015, 03:29 PM
(This post was last modified: 11-25-2015 03:34 PM by Han.)
Post: #3
|
|||
|
|||
RE: GO TO? JUMP?
(11-25-2015 03:08 PM)jrozsas Wrote: Hello. In your sample code, a simple while loop would suffice: 1: Export goto() 2: BEGIN while 1 do 3: nonononono 4: nonoononon 5: nonononono 6: Text(); end 7: END; You can create the equivalent of goto using: Code: EXPORT MYPROG() Each if statement can be considered like a label for a code block. If you want to run through the entire set of blocks, set label:=#FFFFFh (here we are assuming only up to 2^20 labels). If you only want to jump to a specific code block, set label equal to that particular block (e.g. label:=#3h would only execute the third block). This particular scheme, however, would have severe runtime issues if you have many "labeled" blocks of code. I am not particularly fond of GOTO; they are great for assembly-level programs (in fact necessary) but in higher level languages I find that I seldom, if ever, use them. EDIT: Much of the code in the example can be made simpler through the use of subroutines. Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
GO TO? JUMP? [Solved] - jrozsas - 11-25-2015, 03:08 PM
RE: GO TO? JUMP? - Didier Lachieze - 11-25-2015, 03:22 PM
RE: GO TO? JUMP? - Han - 11-25-2015 03:29 PM
RE: GO TO? JUMP? - jrozsas - 11-25-2015, 04:47 PM
RE: GO TO? JUMP? - primer - 11-25-2015, 05:03 PM
RE: GO TO? JUMP? - jrozsas - 11-25-2015, 05:17 PM
RE: GO TO? JUMP? - jrozsas - 11-25-2015, 05:27 PM
RE: GO TO? JUMP? - jrozsas - 11-25-2015, 05:29 PM
RE: GO TO? JUMP? - ji3m - 11-26-2015, 12:05 AM
|
User(s) browsing this thread: 2 Guest(s)