This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace ParseInt | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Success |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This | |
is | |
a | |
pen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
def foo | |
-1 / 0 | |
rescue | |
p 1 | |
end | |
foo | |
# => 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
begin # run | |
p 1 | |
rescue # Do not run , because of no-execption occurs. | |
p 0 | |
else # run , because of no-execption occurs. | |
p 2 | |
ensure # run always at last. | |
p 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
1/0 rescue p 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
begin | |
1/0 | |
rescue ZeroDivisionError => e | |
p e.backtrace | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
begin | |
1/0 | |
rescue ZeroDivisionError | |
p $!.class # => ZeroDivisionError | |
raise # => ZeroDivisionError | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
a = 0 | |
begin | |
b = 1 / a | |
rescue ZeroDivisionError | |
a += 1 | |
retry | |
ensure | |
p b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
begin | |
1/0 | |
rescue | |
p 1 | |
rescue ZeroDivisionError # Do not call | |
p 2 | |
end | |
# => 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: SJIS | |
def foo | |
throw :exit | |
end | |
catch(:exit) { | |
foo | |
p 1 # Do not call | |
} |