2008年3月6日 星期四

range and symbol

Range:
ex:
('A'..'Z')
it is the range between 'A' and 'Z'

change range to array
ex: ('A'..'Z').to_a

check if something is in the range
ex: ('A'..'Z').include?('R')

Symbol:
ex: :good
: + name = symbol
it is more efficient than object
Usage: varying data as object, fixed data as symbol

沒有留言: