Need help solving this! I'm so confused :(


#1

Create a method that passes an integer argument to a single parameter. If the integer is greater than 0 print the numbers from the integer to 0. If the number is less than 0 simply print the integer. Use a for loop, while loop, or unless loop to print the range of numbers from the integer to 0.
For example:
sample(4)
output = 3, 2, 1
sample(-1)
output = -1

 This is what I have so far???
def number (n,m)
	puts n
	while
	n > 0


#2

You can try first checking your number (whether it is bigger than 0 ), then try your loop.
Like:
print "Enter your number: "
num= puts.chomp

if num<=0
puts num
else
while num>=0
puts num
num-=1
end
end