From: Vimal Date: 2006-11-20T19:39:09+09:00 Subject: Re: type information ------=_Part_39525_22031387.1164019146059 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi there! You seem to be from IITB! Great! I am from IIT Madras. > > how does the interpreter (ruby1.8.5) store the type information of a > variable > how will i retrieve it ? If you want to retrieve it in a ruby program, which is what you might want to do obviously, is to use puts variable_name.class You can do comparisons like: if variable_name.class == "String" then do this etc. If you want to know how its handled Inside the interpreter, in C, grep for types like: T_STRING, T_FIXNUM in "ruby.h" Regards Vimal Department of Computer Science and Engineering IIT Madras ------=_Part_39525_22031387.1164019146059 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi there!
You seem to be from IITB! Great! I am from IIT Madras.

how does the interpreter ( ruby1.8.5) store the type information of a
variable
how will i retrieve it ?

If you want to retrieve it in a ruby program, which is what you might want to do obviously, is to use
puts variable_name.class

You can do comparisons like:
if variable_name.class == "String" then do this etc.

If you want to know how its handled Inside the interpreter, in C, grep for types like: T_STRING, T_FIXNUM in " ruby.h"

Regards
Vimal
Department of Computer Science and Engineering
IIT Madras
------=_Part_39525_22031387.1164019146059--