Skip to content

Commit 03a549a

Browse files
authored
Add code (#13)
1 parent e4d78a3 commit 03a549a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/sample.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ def multiply(a, b)
1414
a * b
1515
end
1616

17+
def divide(a, b)
18+
if b.zero?
19+
raise ZeroDivisionError, "Division by zero is not allowed."
20+
else
21+
a / b
22+
end
23+
end
24+
1725
def main()
1826
puts("Hello, world!");
1927

0 commit comments

Comments
 (0)