Simple continue syntax issue

nadia

Trader
Aug 12, 2020
15
2
6
38
MQL4:
      for(int x=0; x<100; x++)
        {
         if(x==1)
            break;
         for(int y=0; y<100; y++)
            if(y>x)
               Print("y ",y);
         break;
        }
How do I use the x from the first for inside the second for loop so that if y is greater to x it lists as correctly? Need it to print from 2 onward, and only once, correctly.

I dont want to just save to a variable and just use in the next for loop when it seems to be a continue thing however its been 4 hours, already checked official docs, didn't solve my issue, I just can't afford more time if its just a 2 second answer

THX
 
Last edited:

Enivid

Administrator
Staff member
Nov 30, 2008
18,533
1,355
144
Odesa
www.earnforex.com
Sorry, but I don't understand your question. The code you posted will print from 1 to 99 only once. Do you need it to print from 2 to 99? Start x from 1 and change the condition above the second loop to x==2.
 

nadia

Trader
Aug 12, 2020
15
2
6
38
thanks!! [solved] it!!
Code:
      for(int x=0; x<100; x++)
        {
         if(x==1)
            for(int y=0; y<100; y++)
               if(y>x)
                 {
                  Print("y ",y);
                  break;
                 }
        }