Re: incrementing loop indexes

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

Bernie and Dave wrote in reference to converting a Euphoria
program to C code:

>>
I've found it a pain ... to skip things inside a loop ...
<<

Well what about using the 'continue' statement?

For example:

y=0;

for ( i = 1; i < 5; i++ )
{
    x = i;
    if ( x == 1 )
        continue;
    y = y + x;  //this is skipped if x=1 because of the continue statement.
}

Good luck with it,
--Al

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

Search



Quick Links

User menu

Not signed in.

Misc Menu