ForNext
Only Do What Only You Can Do
164. catch exception
Hyperpolyglot Interpreted Languages: PHP, Perl, Python, Ruby より (2012.05.08)
VBScript
JScript
Perl
eval { risky }; if ($@) { print "risky failed: $@\n"; }
PHP
try { risky(); } catch (Exception $e) { echo "risky failed: ", $e->getMessage(), "\n"; }
Python
try: risky() except: print('risky failed')
Ruby
# catches StandardError begin risky rescue print "risky failed: " puts $!.message end