How to 'break' from an AM script having if-else condition?
I have a script with few if-elseif conditions. I want to break from the script when it meets a certain condition and do nothing after that.
Is there any AM equivalent for a 'break' statement in Java?
Check out this documenation link :
You will see there is a SELECT CASE statement - does this help you at all ?
Using SELECT CASE is definatelly the way to go if you are checking the same field for multiple values.
However to answer your specific question I believe what you are looking for is "Exit Function". You could also use a GoTo and a Label.
If <condition 1> Then Goto ThisIsTheEnd
<stuff you want to skip>
You might have to check the Syntax on that since I am just freehanding this. GoTo has gotten a bad rap over the years, but it has appropriate uses. Just do not have Goto's crossing back over each other. As a rule of thumb "Always Goto Farther On" is pretty safe. It is all about Readability and Maintainablity. If using a Goto makes your code cleaner and easier to read then it can be a good thing to do.
President - Golden Ratio, Inc.