Author Topic: NOP, "no operation"  (Read 225 times)

Flrn

  • Newbie
  • *
  • Posts: 13
NOP, "no operation"
« 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

Rob S

  • Hero Member
  • *****
  • Posts: 4536
    • Construction Estimating Program for General Contractors
Re: NOP, "no operation"
« Reply #1 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?
User since Pro-design

Lar

  • Hero Member
  • *****
  • Posts: 2818
Re: NOP, "no operation"
« Reply #2 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
« Last Edit: July 20, 2018, 02:28:01 PM by Lar »

Flrn

  • Newbie
  • *
  • Posts: 13
Re: NOP, "no operation"
« Reply #3 on: July 20, 2018, 04:02:40 PM »
Thank you, gentlemen.  Looks like either method would do quite well.

Jim