From: Regg Date: 2006-05-16T03:14:36+09:00 Subject: Re: begining programmer questions But when I hear statements about Ruby being a strong type language, I would expect that to be applied to variables. Most assignments happen between variables. But if what you are saying is that variables are "typeless", then I have to go with the belief that Ruby is a "weak" typed langauge and not a strong one. In C++ (a strong typed language) you can't do this: MyOtherClass *m_otherclass = new MyOtherClass(); MyClass *m_class = new MyClass(); m_class = m_otherclass; <--ERROR (Can't convert MyOtherClass to MyClass) but this seems to be possible in Ruby. Please correct me if I'm wrong (I want to be wrong here). :) > This is the case. However, variables are only references and are > themselves "typeless," in a sense. While you cannot change the object > a variable points to from one type to another, you can have the > variable point to a different object entirely which can be of a > different type. Here is something that won't work: > > "5" + 5 > > Since the two objects are different types, they cannot be added/ > appended. The two correct variations are below: > > "5".to_i + 5 # => 10 > "5" + 5.to_s => "55" > > Hope that clears things up. > > - Jake McArthur -- Posted via http://www.ruby-forum.com/.