equivalent of fortran goto

Hello,

I am fairly new to igor. I am trying to write a fortran code as an igor procedure. My fortran code has several goto statements. How does igor handle such statements? Any help will be appreciated.

Thanks!
First, FORTRAN "goto" requires a target statement label, which Igor does not support. You will have to work around its absence by using Igor 'if', 'switch', 'break', 'try' or other logical means. The best Igor alternative will depend on the context in which your FORTRAN "goto" statement occurs. Read the Manual sections on Igor programming for more details.

That said, you should wind up with cleaner Igor code. "goto" has long been a notorious source of hard to understand "spaghetti code."

One approach might first be to take those sections that are "goto" and write them as stand-alone functions that you call ...

      goto bla
      ...
      goto foo
      ...

bla  do something starting here
      ...
foo  do something else starting here
      ...


... becomes ...

     DoBla()
     return 0
     DoFoo()
     return 0
     ...
end

Function Bla()

     do whatever bla does here
     return 0
end

Function Foo()

    ...
end


Then you can streamline the main code with all of the function calls.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville