From: Morton Goldberg Date: 2006-12-05T07:43:55+09:00 Subject: Re: [QUIZ] Turtle Graphics (#104) [SOLUTION] On Dec 4, 2006, at 2:20 PM, Paul Lutus wrote: > Morton Goldberg wrote: > > / ... > >> case >> when @heading >= 360.0 >> @heading -= 360.0 while @heading >= 360.0 > > @heading %= 360 > >> when @heading < 0.0 >> @heading += 360.0 while @heading < 0.0 > > @heading %= 360 # same solution > > In fact, now that I think about it, the entire block: > > case > when @heading >= 360.0 > @heading -= 360.0 while @heading >= 360.0 > when @heading < 0.0 > @heading += 360.0 while @heading < 0.0 > end > > can be replaced with: > > @heading %= 360 Good catch. I had forgotten that %= existed. Regards, Morton