Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic command — Parallax Forums

PropBasic command

Does anyone know if there is a PropBasic command that can scan a list of numbers and determine if a particular number is present in that list?

As an Example: SkipList[1,4,45,78,23]

If the number 4 is in the list then a section of code will be skipped.

Discovery

Comments

  • The manual will help you.
  • Can you show the code?

    Discovery
  • There are multiple ways to perform that task - there is no single command. I would suggest you try an if/then logical construct and setting or unsetting a flag that enables or disables the section of code you want to skip. Iterate the list, if one of the list members is 4, set a flag and use that flag in another if/then section involving the code section you want to skip. There are plenty of logical structure tutorials out there and, if you haven't utilized them I would strongly suggest doing so. Learn about Boolean operators as well - logical control structure combined with Boolean logic is pretty much at the very core of everything related to programming.
  • Also consider looking through the various library's source, especially anything Bean has authored - his commenting is top notch and I would almost bet you could get some ideas as to concise, clear and efficient ways to do things. BTW, I could cobble up some code that would do what you want but that's just "giving you a fish" and helping you LEARN how to fish I feel will serve you better.
  • Go ahead a cobble up some code...learning how it works comes later.

    Discovery
  • @Discovery,

    so you want to ride a bicycle, fall down and state that you just want to ride a bicycle but not learn how to ride a bicycle?

    curious,

    Mike
  • pmrobert wrote: »
    Also consider looking through the various library's source, especially anything Bean has authored - his commenting is top notch and I would almost bet you could get some ideas as to concise, clear and efficient ways to do things. BTW, I could cobble up some code that would do what you want but that's just "giving you a fish" and helping you LEARN how to fish I feel will serve you better.

    Yup, build a man a fire and he'll be warm for a day - set a man on fire and he'll be warm for the rest of his...erm, life. Something like that, anyway :lol:
  • msrobots wrote: »
    @Discovery,

    so you want to ride a bicycle, fall down and state that you just want to ride a bicycle but not learn how to ride a bicycle?

    curious,

    Mike

    +1
  • So, it is clear that you cannot write the code: however, you can pontificate.

    Parallax...this is your helpful forum!

    Discovery
  • @Discovery,

    no you seem to get this wrong. Nobody here is interested to program for you but helping you to program by yourself.

    So write some code post it and state your problems and question and you will get answers to your questions. But to expect that someone else is writing code for you is - hmm - simply wrong.

    Enjoy!

    Mike
  • Comment deleted.
  • BeanBean Posts: 8,129
    Use

    ON var = value1, value2, value3 GOTO label1, label2, label3

    command.

    Bean
  • Thank you Bean,

    I think that I can make that instruction work by making label1, label2, and label3 the same.

    Sincerely,

    Discovery
  • In retrospect I should have asked you to post the code you've tried that didn't work. My apologies if you took my suggestions the wrong way.
    Peace out, Mike R...
  • pmrobert,

    I accept your apology.
    Posting my code would not be helpful since I was looking for an instruction to accomplish a branching function. Bean understood what I needed and simply provided that instruction.

    Discovery
Sign In or Register to comment.