From: Mark Bush Date: 2008-03-01T00:37:13+09:00 Subject: Re: Beginner Help with code example from book Joseph L. Casale wrote: > I am trying to understand how the following code knows not to count a > tile that has been previously counted, its an example from Chris Pine's > def continent_size world, x, y > if world[y][x] != ' land' > # Either it' s water or we already > # counted it, but either way, we don' t > # want to count it now. > return 0 > end > : > world[y][x] = ' counted land' The world is changed. When ' land' is counted, it turns into ' counted land' so on iteration, the "if" sees that it is not land and returns 0. -- Posted via http://www.ruby-forum.com/.