From: Haibin Shi Date: 2013-05-07T19:07:35+09:00 Subject: The question about 'Range' as Condition Hi All, I don't know why these two codes of behavior will not be the same, in my opinion, they are the same logic. Thanks a lot! Codes: ------------------------------------------------- arr = [ 'head', 'start', 'body', 'end', 'tail' ] # test 1 puts 'loop test:' for i in 0...arr.size puts arr[i] if arr[i] =~ /start/ .. arr[i] =~ /end/ end puts # test 2 puts 'hard test:' puts arr[0] if arr[0] =~ /start/ .. arr[0] =~ /end/ puts arr[1] if arr[1] =~ /start/ .. arr[1] =~ /end/ puts arr[2] if arr[2] =~ /start/ .. arr[2] =~ /end/ puts arr[3] if arr[3] =~ /start/ .. arr[3] =~ /end/ puts arr[4] if arr[4] =~ /start/ .. arr[4] =~ /end/ ------------------------------------------------- The output: ---------- loop test: start body end hard test: start ---------- - Haibin Shi