From: Phrogz Date: 2007-11-02T04:55:04+09:00 Subject: Re: Can we define data types explicitly? On Nov 1, 1:12 pm, dangerwillrobinsondan...@gmail.com wrote: > On Nov 1, 2007, at 1:47 PM, Sebastian Hungerecker wrote: > > User input will always be a string until you convert it. > > user_input = gets > > user_input.is_a? Integer > > Will never be true - even if the user enters a number. > > Oh really?! Perhaps if it comes from a keyboard and stdin, yes. > What about other input devices ?? > Mouse, Joystick/joypad, Stylus, Light pen, other types of sensors > (heat, pressure, wind speed...) > Changing input routines? There is no reason input could not be any > other class in Ruby, including nil. Of course. Obviously (?) Ruby can communicate with the outside world in programmatic ways that don't necessarily involve strings. Network packets are not strings that need to be parsed. Reading a binary file does not go through an intermediary string representation. However, the 's' in 'gets' stands for 'string'. I believe Sebastien was commenting on the original poster's original apparent impression that if the user types "5.5" from the keyboard, it would be a Float.