Copy link to clipboard
Copied
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??
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
...Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Harbs,
Thanks a lot. It worked!! ![]()
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more