From 256f376574bc179d4e131a2ead1e546443efe223 Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Wed, 14 Apr 2021 16:40:39 -0700 Subject: [PATCH] add output for add algo --- maths/add.rb | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/maths/add.rb b/maths/add.rb index 1c756b4..a8a6c35 100644 --- a/maths/add.rb +++ b/maths/add.rb @@ -10,11 +10,25 @@ def add(*array) puts "Error: Please provide number only!" end +# # Valid inputs -add(1) -add(2, 5, -4) -add(25, 45) +# +puts add(1) +# The sum of following elements [1] is 1 + +puts add(2, 5, -4) +# The sum of following elements [2, 5, -4] is 3 + +puts add(25, 45) +# The sum of following elements [25, 45] is 70 + +# # Invalid inputs -add("1", 2, 3) -add("a", 1) +# + +puts add("1", 2, 3) +# Error: Please provide number only! + +puts add("a", 1) +# Error: Please provide number only!