"lookdown" command

rq3

Senior Member
Is there a reasonable way to do something like:

lookdown w0,(<=w1,<=w2,<=w3),w4

Thanks,
Rip
 

AllyCat

Senior Member
Hi Rip,

See Manual 2 for "Select ... Case ...." which would be the "normal" way to do it. But you'd probably find that the Programme Editor will produce much the same code size with a simple sequence of IF ... THENs.

Cheers, Alan
 

rq3

Senior Member
@Alan
Yes, I've played with "Select...Case..." and "If...Thens". And they work just fine. It just struck me that the code would look much more elegant with a simple two line
"lookdown" followed by a "on...goto" to accomplish common tasks like read a pot and turn on the appropriate light. The code doesn't compile any tighter, but it looks better!

Thanks,
Rip
 

hippy

Technical Support
Staff member
If aiming for more a more aesthetic feel in the main source code it might be possible to create a #Macro definition and then hide the 'messier code' in that.
 

fernando_g

Senior Member
..... it might be possible to create a #Macro definition and then hide the 'messier code' in that.
My curiosity is piqued, and would like to learn more.
However, making a search of #Macro on manuals 1 and 2 yielded no results.

And a forum search it appears that this feature is only available for PE6? Am I correct?
 
Last edited:

rq3

Senior Member
My curiosity is piqued, and would like to learn more.
However, making a search of #Macro on manuals 1 and 2 yielded no results.

And a forum search it appears that this feature is only available for PE6? Am I correct?
That appears to be true. And I was counting on hippy to perform one of his usual TADA!!! pieces of code to get "lookdown" to accept range variables, rather than specific variables.
Oh well. Since I, at least, owe hippy my first born for all of his assistance, patience, and diplomacy on this forum, I can't complain.

tick
tick
tick

HIPPY!!! Why can't I put logical range variables (like <=w1) within the lookdown command!? ;-)
 

srnet

Senior Member
Why can't I put logical range variables (like <=w1) within the lookdown command!? ;-)
Because the structure of the command, requires a variable and does not accept condition + variable.

This is the same situation for many of the commands.
 

hippy

Technical Support
Staff member
As srnet says; you cannot do that simply because that's not how LOOKDOWN is defined as a command.

It could have been defined to accept conditions but that would increase the size of program code and slow down program execution. This is the first time I recall seeing that form of the command suggested so it doesn't seem to have been a general requirement and those costs would have been borne by everyone even if they did not require that functionality.

With there being no great necessity for it, and there being other ways to achieve the same results, I doubt the LOOKDOWN command definition is likely to change in the future.
 
Top