Hopefully something less newbish than my last...
Anyhow, I am doing a bit of coding on a small app that simplifies numbers down to primes, mainly to help with small things like homework.
However, a particular method is giving me the error mentioned in the title:
def get_simps(num)
curr = 2
print("Working...")
while (curr <= num)
#If they divide cleanly, then it's a simplified form
if (num % curr == 0)
res = [curr, num / curr]
break
end
curr += 1
end
print("\n")
return res
end
Where the argument num is supplied by this statement:
print("Insert number here: ")
num = gets().chomp().to_i()
Thus making the error weird: why does it say I compare a Fixnum and an ARRAY? I also did this:
if (num.class() == curr.class())
print "Cheese"
end
and it printed Cheese. Why the reason for the error, then?