--Apple-Mail=_D626CBE8-2E75-48AE-BECA-442E0B35C728
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello,

On 17 =CE=9C=CE=B1=CF=81 2014, at 09:48 , Jose Sonhy =
<lists / ruby-forum.com> wrote:

> Hi Guys;
>=20
> I am new to Ruby.

Welcome to wonderland :-)

>=20
> I have a problem getting user input with gets method.
>=20
> The following is a very simple code snippet for me to try this method:
>=20
> print "What's your name? "
> my_name =3D gets
> puts "Nice to meet you " + my_name + "!"
>=20
> When I try to run the code, this is the error that i get:
> What's your name? TypeError: can't convert nil into String

How are you executing this? Because here works fine:

=E2=94=8C=E2=94=80[atma / air] - [~] - [=CE=94=CE=B5=CF=85 =CE=9C=CE=B1=CF=81=
 17, 01:22]
=E2=94=94=E2=94=80[$] <> cat test.rb=20
print "What's your name? "
my_name =3D gets
puts "Nice to meet you " + my_name + "!"
=E2=94=8C=E2=94=80[atma / air] - [~] - [=CE=94=CE=B5=CF=85 =CE=9C=CE=B1=CF=81=
 17, 01:22]
=E2=94=94=E2=94=80[$] <> ruby test.rb=20
What's your name? Nick
Nice to meet you Nick
!
=E2=94=8C=E2=94=80[atma / air] - [~] - [=CE=94=CE=B5=CF=85 =CE=9C=CE=B1=CF=81=
 17, 01:22]
=E2=94=94=E2=94=80[$] <> ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]
=E2=94=8C=E2=94=80[atma / air] - [~] - [=CE=94=CE=B5=CF=85 =CE=9C=CE=B1=CF=81=
 17, 01:22]
=E2=94=94=E2=94=80[$] <>=20


>=20
> How do i fix it? By the way, I am using Ruby 2.0. I have tried on my =
PC=20
> as well as on my android phone with Ruboto, still the error message. =
All=20
> the books I have been reading, they have been using exactly this =
format:=20
> my_name =3D gets
>=20
> Is there a special way of doing it?

Other than adding '.chomp' to escape \$ not really :-)

>=20
> --=20
> Posted via http://www.ruby-forum.com/.



Panagiotis (atmosx) Atmatzidis

email:	atma / convalesco.org
URL:	http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

"The fool doth think he is wise, but the wise man knows himself to be a =
fool." - William Shakespeare


--Apple-Mail=_D626CBE8-2E75-48AE-BECA-442E0B35C728
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: Public Key Encryption

iQIcBAEBAgAGBQJTJulTAAoJEPy01a8ae/7FxuMP/1b2rMKTGX6R9qj7RlViuxA3
eDfTlB2gXtydh3gwC47GvlTHg6M/1sug3ScrMMVEtDyLv1uf3ECHC6+WTUyP53Cq
i7nngrxoLQaAsLr0bT3xTtC/vsm+jXR4Sg1AFPy2jJY1OPjrdRSGswspQMQrOS3T
wDa9ZQwR2hi89U4xplbYhC0YHrN6ZNFnsG3Z/q1iRyi4v1idL68Fk1Tt4uboBAzB
eRHEEAd1RHB8sIjF2KQ5eULap+UC7ExJNUHj4Emix9cMsXFCYiQkHdKS08jDt3/X
JNL3Iz7hUq1tCWpjo9nTWU0vd1ualJxqYwSM0LvVNnBE+LJJxZFZne2OIXdetVr9
qwlHpFIYjIjxEXHNKGKtanJWCN3aIxjeBZj42kqpCMhJJdP6R0eeJxcThF46TiRj
GyKg0drBtoCJ0rNpaQvn/OoI2zVoxC9V+GkXAbChVhLVQG/51+pSFk5CWzzYRJ0N
dhrBN7ykiRMfFus6Klth6uwZG3guRMv+dezdngQIvfz0EtQtDcZnfxjLJvNGiE4E
qwdPAe2y5gB3dLhJp168n5zpFRUCpLmtJ5vVjPY6yloZ3aG/3283gPK0FwYVjTq2
QFkHsPG620e+LO4e4tAZGXNI9FZUgGBwnMBqMX5016m33kruji54ELBgEvz0rNle
FtWJ3IdDYIImyCU8nBpf
=8Dw1
-----END PGP SIGNATURE-----

--Apple-Mail=_D626CBE8-2E75-48AE-BECA-442E0B35C728--