Loading ...
Sorry, an error occurred while loading the content.
 

Any help for the foolish?

Expand Messages
  • darkdna
    I can t get the following snipet of code to work. I have a 17 by 17 array set up that sets the various binary values and some other things. Code: PROMPT Enter
    Message 1 of 5 , Oct 5, 2004
      I can't get the following snipet of code to work. I have a 17 by 17
      array set up that sets the various binary values and some other
      things.
      Code:
      PROMPT "Enter a data cell you would like the value of, in the format
      X(Column number,Row number)" ;Value$
      IF Value$ = "X("1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 10 OR
      11 OR 12 OR 13 OR 14 OR 15 OR 16 OR 17","1 OR 2 OR 3 OR 4 OR 5 OR 6
      OR 7 OR 8 OR 9 OR 10 OR 11 OR 12 OR 13 OR 14 OR 15 OR 16 OR 17")"
      THEN

      /Code
      Do you get what I want it to do? Is there a way to do this?
    • darkdna
      Edit: Nevermind, I got it I think.
      Message 2 of 5 , Oct 5, 2004
        Edit: Nevermind, I got it I think.
      • Richard Wilson
        ... From:To: libertybasic@yahoogroups.com Subject: Re: [libertybasic] Any help for the foolish? Date: Tue, 05 Oct 2004 19:13:17 -0700 ... Yes. Try not to make
        Message 3 of 5 , Oct 5, 2004
          ------- Forwarded message -------
          From:To: libertybasic@yahoogroups.com
          Subject: Re: [libertybasic] Any help for the foolish?
          Date: Tue, 05 Oct 2004 19:13:17 -0700

          On Wed, 06 Oct 2004 01:54:37 -0000, darkdna <darkdna@...> wrote:

          >
          > I can't get the following snipet of code to work. I have a 17 by 17
          > array set up that sets the various binary values and some other
          > things.
          > Code:
          > PROMPT "Enter a data cell you would like the value of, in the format
          > X(Column number,Row number)" ;Value$
          > IF Value$ = "X("1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 10 OR
          > 11 OR 12 OR 13 OR 14 OR 15 OR 16 OR 17","1 OR 2 OR 3 OR 4 OR 5 OR 6
          > OR 7 OR 8 OR 9 OR 10 OR 11 OR 12 OR 13 OR 14 OR 15 OR 16 OR 17")"
          > THEN
          >
          > /Code
          > Do you get what I want it to do? Is there a way to do this?
          >
          Yes. Try not to make it so difficult. Just ask for a column then a row
          and use those values for extracting the data for that item in the array.
          also prompt for a range of values i.e 1 to 17. You know that an array
          usually works from 0 to 16 when you dim it for 17 x 17 first item (0,0),
          last item (16,16). Anyway check with Liberty Basic documentation on arrays.

          brorichard@...
          >
          >
          > Yahoo! Groups Sponsor
          > ADVERTISEMENT
          >
          > Yahoo! Groups Links
          >
          > To visit your group on the web, go to:
          > http://groups.yahoo.com/group/libertybasic/
          >
          > To unsubscribe from this group, send an email to:
          > libertybasic-unsubscribe@yahoogroups.com
          >
          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



          --
          Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
        • pendl2megabit
          The statement DIM X(17,17) will create an array with elements from X(0,0) to X(17,17). The statement IF value = 1 or 2 or 3 or ... will never work, because
          Message 4 of 5 , Oct 6, 2004
            The statement DIM X(17,17) will create an array with elements from X(0,0) to
            X(17,17).

            The statement IF value = 1 or 2 or 3 or ... will never work, because these are
            no condition pairs.
            You will have to use:
            IF value = 1 or value = 2 or value = 3 ...

            A better way is to check if the value is in a range:
            IF value >= 1 and value <= 17 then ...

            You may use SELECT CASE, if you want to skip certain elements:
            SELECT CASE value
            CASE 1,2,5,7,8 ...

            As richard says in your case it would be better to ask for the information one
            by one.

            [enterRow]
            prompt "enter row number (1 to 17)"; row
            if row < 1 or row > 17 then
            notice "value error":chr$(13);_
            "value for row is out of the range from 1 to 17"; _
            chr$(13);"please reenter"
            goto [enterRow]
            end if
            [enterColumn]
            prompt "enter column number (1 to 17)"; column
            if column < 1 or column > 17 then
            notice "value error":chr$(13);_
            "value for column is out of the range from 1 to 17"; _
            chr$(13);"please reenter"
            goto [enterColumn]
            end if
            print X(row,column)

            ---
            Stefan Pendl


            > -----Urspr√ľngliche Nachricht-----
            > Von: Richard Wilson
            >
            > Yes. Try not to make it so difficult. Just ask for a column then a row
            > and use those values for extracting the data for that item in the array.
            > also prompt for a range of values i.e 1 to 17. You know that an array
            > usually works from 0 to 16 when you dim it for 17 x 17 first item (0,0),
            > last item (16,16). Anyway check with Liberty Basic documentation on arrays.
            >
            > brorichard
          • Ken Lewis, Sr.
            ... From: Richard Wilson ... When you dimension an array in LB, you have 1 more item than you ask for in each dimension. Dim a$(17)
            Message 5 of 5 , Oct 6, 2004
              ----- Original Message -----
              From: "Richard Wilson" <brorichard@...>


              >
              > ------- Forwarded message -------
              > From:To: libertybasic@yahoogroups.com
              > Subject: Re: [libertybasic] Any help for the foolish?
              > Date: Tue, 05 Oct 2004 19:13:17 -0700
              >
              > On Wed, 06 Oct 2004 01:54:37 -0000, darkdna <darkdna@...> wrote:
              >
              >>
              > Yes. Try not to make it so difficult. Just ask for a column then a row
              > and use those values for extracting the data for that item in the array.
              > also prompt for a range of values i.e 1 to 17. You know that an array
              > usually works from 0 to 16 when you dim it for 17 x 17 first item (0,0),
              > last item (16,16). Anyway check with Liberty Basic documentation on
              > arrays.


              When you dimension an array in LB, you have 1 more item than you ask for in
              each dimension.

              Dim a$(17)
              this gives you 18 elements...0 thru 17

              Hope this clears this up
              Ken
            Your message has been successfully submitted and would be delivered to recipients shortly.