Debugging
The debugging functions help you figure out just what the heck is going on with the inevitable broken script. Some of these functions make diagnostic information available to you inside your script. Others communicate with either a system log or a remote debugger. Practical approaches to debugging are addressed in Chapter 21, "Design."
assert(expression)
The assert function tests an expression. If the assertion is true, no action is taken and the script continues. If the assertion is false, behavior is dictated by the assertion options. By default, assertions are not active, which means they are simply ignored. Use assert_options to activate them.
Assertions are a nice way to add error checking to your code, especially paranoid checks ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access