From: Yong Li Date: 2011-12-07T11:16:20+09:00 Subject: Re: Ruby way to define binary On Wed, Dec 7, 2011 at 4:05 AM, Misha Ognev wrote: > hi2all > > I have some trouble. How can i define the binary of value in ruby? (I > have a value, and I want to know that's it true or false). > > The simplest (but not good in my opinion) way is to do it: > >> v = value.to_s >> return v == "false" | v == "true" > > What method I can use? I can't find something helpful in core. > > Thanks, Michael > > -- > Posted via http://www.ruby-forum.com/. > not sure I understand your question correctly, but Ruby does not offer boolean data type as in many other programming languages. However, there are "true" and "false" objects which you can use for that purpose: v = true # or v = false if v then puts "v is true" else puts "v is false" end