Re: Wishlist
- Posted by Irv Mullins <irvm at ellijay.com> Jun 27, 2001
- 572 views
On Wednesday 27 June 2001 17:50, david at aldred.demon.co.uk wrote: > While we're on wishes... > > I'd like x++ and x-- to be equivalent to x +=1 and x -=1. I keep using > them automatically without thinking - what comes from a past using C and > enhanced Psion OPL! Would you settle for just the x++ ? Something tells me the -- is already spoken for. > And from even further back in my programming history, but something I've > missed since using Algol - > > for i = {1,4,5.6,e/2, sin(theta)} do > (something with i) > next > > which then does the loop for the values in the sequence, one at a time. > This is actually not quite the same as > > s = {1,4,5.6,e/2,sin(theta) } > for i=1 to 5 do > (something with s[i]) > next > > since the e/2 is allocated when the loop gets to it, not before, and e > might have changed since then! If I recall correctly, that would be impossible with Euphoria, which makes a copy of the loop variables before beginning, so any change would be disregarded. Let's see: atom x, y x = 1 y = 10 for i = x to y do x -=1 ? i end for Yep, counts from 1 to 10. Regards, Irv