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

Re: [PrimeNumbers] ubasic loop

Expand Messages
  • Ignacio Larrosa Cañestro
    ... You can use something as this: list 10 Op=0 20 for I=1 to 100 30 for J=1 to 100 40 if I=50 and J=50 then cancel for:Op=1:goto 60 50 next J 60
    Message 1 of 3 , Jan 6, 2008
    • 0 Attachment
      Jenny Cruz wrote:
      > hi. i need help with ubasic. how do i write a double loop properly...
      >
      > for example:
      >
      >
      > for I=0 to 100
      > for J=0 to 100
      > if p(i,j)is true then cancel for,for: goto ...
      > next J
      > next I
      > print I,J
      > end
      >
      > i tried this but something's wrong...please help me..


      You can use something as this:

      list
      10 Op=0
      20 for I=1 to 100
      30 for J=1 to 100
      40 if I=50 and J=50 then cancel for:Op=1:goto 60
      50 next J
      60 if Op=1 then Op=0:cancel for:goto 80
      70 next I
      80 print I,J
      OK
      run
      50 50
      OK

      Saludos,

      Ignacio Larrosa Cañestro
      A Coruña (España)
      ilarrosa@...
    Your message has been successfully submitted and would be delivered to recipients shortly.