Permalink
Browse files

Modify.

  • Loading branch information...
2 parents 213aacc + 5c97fe0 commit 6d01ac3b0f501346827759779b856a4ba1322edb @ichinohe ichinohe committed Jun 23, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 calc.rb
View
18 calc.rb
@@ -1,4 +1,22 @@
+case ARGV[3]
+when '+'
+ p ARGV[0], ARGV[1], ARGV[3]
+when '-'
+ p ARGV[0], ARGV[1], ARGV[3]
+when '*'
+ p ARGV[0], ARGV[1], ARGV[3]
+when '/'
+ div(ARGV[1], ARGV[3])
+else
+ exit
+end
+
+def div( op1, op2 )
+ return op1/op2
+end
+
def multiply(a, b)
a * b
end
+p div(10,4)

0 comments on commit 6d01ac3

Please sign in to comment.