Numbers and groups

Hello everybody i am a new ruby user and i learn best by doing. so i am
trying to code what i would imagine to be a better tool tracjing system
for y work. right now i am trying to figure out how to get a number to
pull up a name. The various way’s i have tried to do this is:

44523 = “andrew lee”
44523.to_s. = “andrew lee”
44523.to_s. {"arg1 = “andrew lee”}

I would really like some help im sure this is a simply done but i cant
figure it out thanks for your help.

Is there another language where you could do something like this?

You can use a hash if you want something similar

irb(main):019:0> my_hash = { 44523 => “andrew lee” }
=> {44523=>“andrew lee”}
irb(main):020:0> my_hash[44523]
=> “andrew lee”

On Wed, Mar 6, 2013 at 2:04 PM, Andrew l. [email protected] wrote:

figure it out thanks for your help.
No language I’m currently familiar with allows you to assign one
literal to another.

44523 is not a variable, it is a literal FixNum in Ruby, and a literal
of some kind of integer in other languages.

So you cannot convert 44523 or any other umber into an array or hash or
anything that changes that value into something that can have something
assigned to it?

Subject: Re: Numbers and groups.
Date: gio 07 mar 13 03:45:56 +0900

Quoting Andrew l. ([email protected]):

So you cannot convert 44523 or any other umber into an array or hash or
anything that changes that value into something that can have something
assigned to it?

Of course you can use an integer as a key to a hash:

irb(main):001:0> h={}
=> {}
irb(main):002:0> h[44523]=‘a string’
=> “a string”
irb(main):003:0> h[71234]=‘another string’
=> “another string”
irb(main):004:0> h
=> {44523=>“a string”, 71234=>“another string”}
irb(main):005:0> h[44523]
=> “a string”

Carlo

thank you carlo i figured it out thanks