Re: else on for

new topic     » goto parent     » topic index » view thread      » older message » newer message

Karl Bochert wrote:

> I very much like [else],  but shouldn't the sense be reversed?
>
>     for i = 1 to length( s )
>        if s[i] = 999 then
>           break
>        end if
>     else
>        printf( "999 WAS found!!" )
>     end for

I see what you mean, but no. At least, not the way Python implements it, which 
is where I stole it from. Think of it this way: knowing the value was found 
it the easy part. That it wasn't found is more problematic.


-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu