How to break, exit, abort, fail, raise or whatever in a Script

In the other thread you posted a nested module example whose outer module, inner module and next inner scope(s) where all left justified against the left margin. Most code editors add an indent guideline to match up the start and end of block/scope levels.

Example from my editor (Notepad++) with the indent guidelines set to yellow …

image

When multiple levels are up against the left margin, indent guidelines cannot be seen.

It came from your copied code. I fixed the snippet you referred to.

Hank, you need to use ‘Text’ >> ‘Detab’ set at 2 spaces, in TextWrangler/BBEdit for the forum to use the correct formatting…

it shows tabs as 4 spaces…

john

Just for the record, fail() / raise() are a global method defined in the Kernel module.
Most style guides are now encouraging using the fail() alias when your code is directing Ruby to cause some specific exception to be created and raised, and use the raise() alias only inside rescue blocks when re-raising the current exception (that caused the rescue block to be evaluated.) But a lot in these style guides are so subjective.

Basic info on exceptions are in the doc: File: exceptions.rdoc [Ruby 2.2.4]
as well as the Exception class documentation and the Kernel module docs on those methods used to manipulate exceptions and their callstacks.

Oh I see. OK, yes, I can fix that. I also figured out how to change my Tab Spacing to 2 lines in Brackets.

"spaceUnits": 2,

In the brackets.json pref file.

Thanks.