From: Eero Saynatkari Date: 2006-10-11T04:12:30+09:00 Subject: Re: need help with $end vs kEND error --T7mxYSe680VjQnyC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2006.10.11 03:23, Kd Kushelduv wrote: > as far as i can tell nothing is missing > here is the code (its only three methods): >=20 > def promptToQuit > print "\nYou did not enter any numbers \n are you sure you wish to=20 > quit? (y/n): " > answer =3D getc > answer =3D answer.downcase > while (answer !=3D 'y' && answer !=3D 'n') > print "Are you sure you wish to quit? (y/n): " > answer =3D getc > answer =3D answer.downcase > end >=20 > return answer > end >=20 > def getNumbers (num) > $high =3D num > $low =3D num >=20 > while (num !=3D 0) > print "Please enter a number (0 to quit): " > num =3D geti >=20 > if ( (num > $high) && (num !=3D 0) ) then > $high =3D num > else if ( (num < $low) && (num !=3D 0) ) then > $low =3D num Right here. You want elsif, otherwise you are missing the closing end for the nested if. Also, drop the thens, they are not needed :) > end > end > end >=20 > answer =3D 'n' >=20 > print "\nPlease enter a number (0 to quit): " > num =3D geti >=20 > if (num =3D=3D 0) then > answer =3D promptToQuit > end >=20 > if (answer =3D=3D 'y') then > print "\nGoodbye" > else > num =3D 1 > getNumbers(num) > end >=20 > puts "Highest Number: " + $high.to_s > puts "Lowest Number: " + $low.to_s > puts "\n" The error message is a bit ambiguous--$end means EOF, which Ruby encountered while it was still waiting for a literal end (the token is called kEND). --T7mxYSe680VjQnyC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFK/AR7Nh7RM4TrhIRArDCAKCtzU965WGEzz4grrYwLsQBha3bPACgkbtK mGdhzWygOFqib907OboOlww= =745Q -----END PGP SIGNATURE----- --T7mxYSe680VjQnyC--