0
I was doing of one of codewars.com exercises and was asked to return the last element of the list.
Here is my answer
def last a,*x
x.size >= 1 ? x[-1] : a[-1]
end
Here are sample test
last( [1,2,3,4] ) # => 4
last( "xyz" ) # => z
last( 1,2,3,4 ) # => 4
Test.assert_equals(last([1,2,3,4,5]...