User bio

The first two systems I worked with using InterSystems technology were a PDP-11 running M11+ and a VAX 11/750 running M/VX. Too many years ago to count! 😊
Since then I've used most, if not all, InterSystems products up to IRIS and HealthShare today.
I'm Italian living in Switzerland and I work as Senior Consultant at GAIVOTA consultin SA, we provide professional services for InterSystems and other technologies.
Curiosity: apart from DC, I don't have ANY social account! 😁

Show all
Member since Aug 4, 2017
Replies:

@Robert Barbiaux 


"return" is equivalent to "quit" with argument, thus is has only one form and one, clear meaning : returning a value.

Both Quit and Return can be used with or without an argument (returned value),  see the documentation for details.

RETURN and QUIT differ when issued from within a FOR, DO WHILE, or WHILE flow-of-control structure, or a TRY or CATCH block.

You can use RETURN to terminate execution of a routine at any point, including from within a FOR, DO WHILE, or WHILE loop or nested loop structure.

In the context of the main post/question example Quit and Return can be used and there is no difference, the behave the same way.

Personally I never use Return simply because I don't consider a good practice to exit a method in the middle of a FOR, DO WHILE, or WHILE flow-of-control structure, or a TRY or CATCH block, to me it's like, or worst, than using a GOTO command. In my opinion good code should have one exit point at the end of a method, not a random number of exit point in the middle of nested structure inside the method, therefore the newly introduced Return command is of no use for me. Again, this is my very personal opinion.

Certifications & Credly badges:
Global Masters badges:
Followers:
Following:
Enrico has not followed anybody yet.