From: Jean-Hugues ROBERT Date: 2002-03-26T23:46:30+09:00 Subject: Why is '?' OK in a method name and not OK in a variable name ? Hello, Sorry if this is a beginner question. Following the Principle Of Least Surprise (POLS?) I tried to write: class CacheEntry attr_reader :dirty? def initialize() @dirty? = false # Syntax error end xxxx other stuff end I expected to be able to then write if some_cache_entry.dirty? then xxxx But that does not work, because apparently '?' cannot be included in a variable's name. As a result I ended up writing class CacheEntry def initialize() @is_dirty = false end def dirty? return @is_dirty end end Is there a better way ? Thanks, Jean-Hugues --------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com