Shop OBEX P1 Docs P2 Docs Learn Events
Goto in spin — Parallax Forums

Goto in spin

christopherchristopher Posts: 31
edited 2006-09-04 23:47 in Propeller 1
hI,

It seems that there are no gotos or jump instructions in Spin. Is there a way to a acheive same apart from the if and case constructs?


Thank you

Chris

Comments

  • T ChapT Chap Posts: 4,223
    edited 2006-09-03 13:33
    Chris you can do something similar, but not exactly linear as Pbasic. For example:

    
    Pub Start
      Repeat
         Something1
         Something2
       
    
    Pub Something1
    'code
    
    Pub Something2
    'code
    
    
    
  • christopherchristopher Posts: 31
    edited 2006-09-04 20:33
    Many thanksc, I'll try it!


    Christopher
  • drkdrk Posts: 2
    edited 2006-09-04 22:32
    Pub Start
    Repeat<
    why does it need?
    Something1
    Something2


    Pub Something1
    'code

    Pub Something2
    'code

    It is not good:

    Pub Start
    Something1
    Something2

    Pub Something1
    'code

    Pub Something2
    'code
  • NewzedNewzed Posts: 2,503
    edited 2006-09-04 22:50
    You don't have to have the "repeat".· That just keeps the program in an endless loop.· If you don't use the "repeat", then you have to tell the program where to go after dosomething2, else it will just sit.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • drkdrk Posts: 2
    edited 2006-09-04 22:56
    Thanks!
  • T ChapT Chap Posts: 4,223
    edited 2006-09-04 23:47
    You can also do things like this:

    If somevariable == 1
    Something1 ' <
    code will jump form here to the Pub or Pri Somthing1


    In this case, and someone correct this if needed, but it aways returns to where it was called from.
Sign In or Register to comment.