IoLanguage / io

Io programming language. Inspired by Self, Smalltalk and LISP.
http://iolanguage.org
Other
2.66k stars 298 forks source link

argument 0 to method '<' must be a Sequence, not a 'Number' #475

Closed yegor256 closed 5 months ago

yegor256 commented 5 months ago

I'm doing this:

n := System args at(1)
if(n < 0, writeln("n must be positive!"))

I'm getting:

Exception: argument 0 to method '<' must be a Sequence, not a 'Number'

What's wrong?

yegor256 commented 5 months ago

apparently, this works:

n := System args at(1) asNumber
if(n < 0, writeln("n must be positive!"))
stevedekorte commented 5 months ago

Hm, that looks like it might be a bug in the error message where it swaps the required and given types.

zephyrtronium commented 5 months ago

Looks right to me. The receiver of < is a string, so it expects a string to compare to, but the argument is 0. Hence, "must be a Sequence, not a 'Number'."

stevedekorte commented 5 months ago

Yes, that sounds right.

Looks right to me. The receiver of < is a string, so it expects a string to compare to, but the argument is 0. Hence, "must be a Sequence, not a 'Number'."