Skip to content

Instantly share code, notes, and snippets.

@mistyrinth
Created November 21, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mistyrinth/3f49f7e3a02db8c4ee0d1705b2bcfeda to your computer and use it in GitHub Desktop.
Save mistyrinth/3f49f7e3a02db8c4ee0d1705b2bcfeda to your computer and use it in GitHub Desktop.
def compare(num1, num2)
print("1つめの商品は ", num1, " 円です。\n")
print("2つめの商品は ", num2, " 円です。\n")
if num1 > num2
return [num1 + num2, num1 - num2]
else
return [num1 + num2, num2 - num1]
end
end
plus, minus = compare(1200, 3300)
print("2つの合計は ", plus, " 円です。\n")
print("2つの差額は ", minus, " 円です。\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment