DesignCAD User Forum

DesignCAD SDK => BasicCAD => Topic started by: Flrn on July 20, 2018, 09:58:32 AM

Title: NOP, "no operation"
Post by: Flrn on July 20, 2018, 09:58:32 AM
Does the language include some equivalent of "NOP," which might be used in a one-line:

                         IF (condition) THEN NOP     'no operation?

While not essential, such a structure might be less wasteful of running time.

Have looked at DT's excellent/helpful, "BasicCAD V17 Reference Manual" and 'exhausted' my guesses as to what such a feature might be called.

Thanks,
Jim
Title: Re: NOP, "no operation"
Post by: Rob S on July 20, 2018, 10:33:43 AM
Would that not be accomplished by either directing the macro to proceed to the next step, or to end as the case may be?
Title: Re: NOP, "no operation"
Post by: Lar on July 20, 2018, 01:54:18 PM
There is an "exit for" to get out of a for/next loop if some condition is met before the full count...

for a=b to c
do some stuff
if a equals some value then exit for
next
(only the underlined is legitimate code)

Similarly, there is an "exit do" for "do while/loop".




When I don't want to exit the loop but just want to skip an iteration I use my "goto NEX/NEX:" (this is similar to what Rob is talking in his post above)


for a=b to c
do some stuff
if a equals some value then goto NEX
do some stuff
NEX:
next

Rob's "End" example:

for a=b to c
do some stuff
if a equals some value then END   'this would terminate the entire macro...
do some stuff
next



Lar
Title: Re: NOP, "no operation"
Post by: Flrn on July 20, 2018, 04:02:40 PM
Thank you, gentlemen.  Looks like either method would do quite well.

Jim