Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to use goto function?

New Here ,
Aug 02, 2011 Aug 02, 2011

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??

TOPICS
Scripting
628
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Aug 02, 2011 Aug 02, 2011

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:

do

{

     if(condition1 == false)

          break;

     if(condition2 == false)

          break;

     if(condition3 == false)

          break;

     doSomethingReallyCool();

}while(false);

"break" jumps to the end of the do/while loop which always

...
Translate
LEGEND ,
Aug 02, 2011 Aug 02, 2011

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:

do

{

     if(condition1 == false)

          break;

     if(condition2 == false)

          break;

     if(condition3 == false)

          break;

     doSomethingReallyCool();

}while(false);

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

Harbs

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2011 Aug 02, 2011
LATEST

Harbs,

Thanks a lot. It worked!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines