Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: patu90da/iOSStudyGroup
base: 5c97fe04e4
...
head fork: patu90da/iOSStudyGroup
compare: 121b8efd74
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Jun 23, 2012
SAKAI, Atsushi radioboo Add plus function c49c585
Yuki Okubo Merged. 121b8ef
Showing with 8 additions and 5 deletions.
  1. +8 −5 calc.rb
13 calc.rb
View
@@ -1,12 +1,12 @@
case ARGV[3]
when '+'
- p ARGV[0], ARGV[1], ARGV[3]
+ p plus(ARGV[1].to_i, ARGV[2].to_i)
when '-'
- p ARGV[0], ARGV[1], ARGV[3]
+ p minus(ARGV[1].to_i, ARGV[2].to_i)
when '*'
- p ARGV[0], ARGV[1], ARGV[3]
+ p (ARGV[1].to_i, ARGV[2].to_i)
when '/'
- div(ARGV[1], ARGV[3])
+ p div(ARGV[1].to_i, ARGV[2].to_i)
else
exit
end
@@ -15,4 +15,7 @@ def div( op1, op2 )
return op1/op2
end
-p div(10,4)
+def plus( operand1, operand2 )
+ result = operand1 + operand2
+ return result
+end

No commit comments for this range

Something went wrong with that request. Please try again.