Ruby

37
1286 reads

February 26, 2013

Rescue Exception 2


I am not generally too keen on relying upon global variables, particularly when they have ‘names’ as undescriptive as $!. Fortunately, there is an alternative.

326
3573 reads

February 26, 2013

Rescue Exception


The basic syntax of exception handling can be summarised as follows: begin # Some code which may cause an exception rescue # Code to recover from the exception end Here is an example

239
2280 reads

February 26, 2013

Exception tree


Exceptions Have A Family Tree

106
1888 reads

February 26, 2013

Error Number


Code can be used to display a list of all Errno constants along with their numerical values

328
2987 reads

February 26, 2013

Divide by zero


The example demonstrates the concept of exception When this code is run, the attempt to divide by zero causes an exception.

146
1709 reads

February 26, 2013

Error Numbers


Often, when an exception occurs, the exception class is an instance of a specific named type such as ZeroDivisionError or NoMethodError.

289
2768 reads

February 26, 2013

Catch and Throw Ruby


In some languages, exceptions are trapped using the keyword catch and may be raised using the keyword throw.

39
1229 reads

February 26, 2013

Global Variables


Using Global Variables

40
1338 reads

February 26, 2013

How to Comment


Learn how to comment in Ruby

21
1392 reads

February 26, 2013

Define a class and create some objects


Creating a class and objects of that class