Shop OBEX P1 Docs P2 Docs Learn Events
lookdown behavior — Parallax Forums

lookdown behavior

ArchiverArchiver Posts: 46,084
edited 2002-02-04 04:19 in General Discussion
Hello,
if i have:
value var ind
value2 var value
ok..

lookdown value, (1,2,3..ect.)
will lookdown read InD just once? or will it read inD once for every
single value in the lookdown list? silly but i don't know.

if more than once (i don't want that)
value2 being an alias will not read InD will it?

Another thing I wonder about is will lookdown jump to branch as soon
as it finds it's "first match" or will continue lookdown to the end
of the list for no reason? Just asking because this will decide how i
code my program in some respects.


Thanks..that's it.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-02-04 04:19
    In a message dated 2/3/02 9:35:12 PM Central Standard Time, cbielek@y...
    writes:


    > if i have:
    > value var ind
    > value2 var value
    > ok..
    >
    > lookdown value, (1,2,3..ect.)
    > will lookdown read InD just once? or will it read inD once for every
    > single value in the lookdown list? silly but i don't know.
    >
    > if more than once (i don't want that)
    > value2 being an alias will not read InD will it?
    >
    > Another thing I wonder about is will lookdown jump to branch as soon
    > as it finds it's "first match" or will continue lookdown to the end
    > of the list for no reason? Just asking because this will decide how i
    >


    The way you've written your program, whenever InD changes you will
    automatically see changes in value and value2. This is because those
    variables are not actually part of the program variable space. They are, in
    fact, pointers to InD. If you check the memory map with the declarations you
    have above, you'll see that there are no variables used.

    If you want to read InD and preserve it, just define a simple NIB variable
    and read it with an assignment (myNibVar = InD).

    In your program, when the LOOKDOWN line is hit, the current value of InD will
    be use (since value points to InD). As far as LOOKDOWN, if there is no match
    found in the list, the output variable will not be affected.

    -- Jon Williams
    -- Parallax


    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.