My code is not printing on the meta trader 4.

To add comments, please log in or register
Chukwueloka Okafor-Ezisi
21
Chukwueloka Okafor-Ezisi  

Hello community, please my "else" statement is not printing on the mt4. Below is the code:


void OnStart()

  {

//---

   int x = 10;

   int y = 100;

   

   if (x == 10) {

      Print(x);

      Print("I hate Mondays");

      Print("I love Fridays"); 

      if(y == 100) {

         Print("I just printed a nested if");

      } 

    } else {

         Print("I'm printing the else");

      

    }


The "Print("I'm printing the else"); is not executing.


What could be wrong please?


Thanks. 

Marco vd Heijden
Moderator
9221
Marco vd Heijden  
you didnt close the if 10 }
Arash Lakzadeh
5702
Arash Lakzadeh  

Because Print("I'm printing the else") works if x is not equal to 10 .

But now x is equal 10 .

Chukwueloka Okafor-Ezisi
21
Chukwueloka Okafor-Ezisi  
Arash Lakzadeh:

Because Print("I'm printing the else") works if x is not equal to 10 .

But now x is equal 10

Thanks Arash;


I just figured it out. 

Arash Lakzadeh
5702
Arash Lakzadeh  
Chukwueloka Okafor-Ezisi:

Thanks Arash;


I just figured it out. 

You're welcome.

Good luck

To add comments, please log in or register