# What errors here

214

Hi Folks.

What could be wrong with this code?

``` if(Hour() > 23 && Hour() < 24)
{ if(Minute()>1 && Minute()<29 && pipe_red==true)
{
pipe_red=false;
}
if(Minute() > 31 && Minute()< 59 && pipe_red==false)
{
}
} ```

The code within will not execute.

Thanks yo'all for reponses.

588

if you want to test between 23h and 24h

```if (Hour()>=23){
//...
}```
18299

Kenneth Njuguna: What could be wrong with this code? The code within will not execute.
1. It executes just fine. It does exactly what you said to do. Don't blame the code or MTx, blame yourself.

2. ` if(Hour() > 23 && Hour() < 24)`
If Hour is 23 or less first condition is false. Hour will never be 24, second condition is always true. If statement is never true. #1

3. ```if(Minute()>1 && Minute()<29 && pipe_red==true)
{
pipe_red=false;
}
if(Minute() > 31 && Minute()< 59 && pipe_red==false)
{
what is missing?
}```
Second if has no result.

4. What about when Minute equals zero, one, twenty nine (29,) thirty (30,) or fifty nine (59)?

5. Simplify your code
`pipe_red = Minute() <= 30;`

214

paul selvan:

if you want to test between 23h and 24h

Much appreciated Paul Selvan.

214

whroeder1:
1. It executes just fine. It does exactly what you said to do. Don't blame the code or MTx, blame yourself.

2. If Hour is 23 or less first condition is false. Hour will never be 24, second condition is always true. If statement is never true. #1

3. Second if has no result.

4. What about when Minute equals zero, one, twenty nine (29,) thirty (30,) or fifty nine (59)?

5. Simplify your code

What looks like missing bits is actually code to print out certain variables that i need to track at the close of business. The Print() function never gets executed. Will simplify the code as you suggested >=30 , leave it overnight and see if the print command is ran. Thanks much appreciated.