2 Replies Latest reply on Aug 2, 2011 12:03 PM by himanshuXRX

    how to use goto function?


      how to use goto function in indesign javascript??


      my script starts with chekcing whether input files are present or not.. if any of the input files r not present, i want to skip the function n terminate the functioning with displaying the message tht file doesnt exisit.... i was wondering to use goto function for tht...so how to use it? or is there any other alternative to that??

        • 1. Re: how to use goto function?
          Harbs. Level 6

          goto is generally frowned on by programmers.


          The only legitimate use of goto is when you need to escape a nested loop.


          If you need to skip part of a routine, use break, or simply return from the current function.


          The pattern commonly used by the SDK looks like this:


               if(condition1 == false)
               if(condition2 == false)
               if(condition3 == false)


          "break" jumps to the end of the do/while loop which always exits when you reach the end of it (while(false))



          • 2. Re: how to use goto function?
            himanshuXRX Level 1



            Thanks a lot. It worked!!