Shop OBEX P1 Docs P2 Docs Learn Events
LOOKUP question — Parallax Forums

LOOKUP question

basicstampedebasicstampede Posts: 214
edited 2004-10-12 11:55 in BASIC Stamp
1)· LOOKUP keyIn, [noparse][[/noparse]"0123456789ABCD*#"], char

vs.

2)· LOOKUP keyIn, [noparse][[/noparse]"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "*", "#"], char

The 2 statements above seem to behave same.

Are they equivalent?

What is it about the 1st statement that allows me to just string them without having to break using comma, yet still get same result as if I separated them by commas (as in 2nd statement)?

Thanks.

Comments

  • WorapohtWorapoht Posts: 17
    edited 2004-10-11 14:57
    Both statement are identical.
    get an idea of table lookup, "0123456789ABCD*#" then seperated each character "0" "1" ... as you do
    both of them still ASCII character, nothing made changed

    Why same? on BASIC Stamp data size is organized as bit / nibble / byte and word. others is just decoration formatted then string above is a set of ASCII code and no string terminate code as high-level PC progamming lang.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-12 11:55
    The BASIC Stamp looks at a string constant as an array of bytes, hence both versions of your code are compiled identically. The first, however, is easier to enter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.