# Maths

#### Mark.R

##### Member
Evening all I'm having a play again, always find the best way to learn is a bit of trial and error but I can't work out the below if any of you can help.

I currently have the below in a piece of code and it works fine

Code:
``````Temp_Check_1A:
pause 500
sertxd(#b1,"c  Water Temp",13,10)
if b1 >= 80 then Up_Temp
if b1 >= 55 then Temp_Check_1B
if b1 <= 54 then Burner_Up_Ramp``````
This works fine but as I say I've been having a play and I cannot get the -1 to work.

Code:
``````b2 = 80
b3 = 55

Temp_Check_1A:
pause 500
sertxd(#b1,"c  Water Temp",13,10)
if b1 >= b2 then Up_Temp
if b1 >= b3 then Temp_Check_1B
if b1 <= b3 - 1 then Burner_Up_Ramp``````
it's the last line that returns an error and I can't fathom it

#### Pongo

##### Senior Member
It can't handle the calculation within the "if"
Code:
``````b3 = b3 - 1
if b1 <= b3 - 1 then Burner_Up_Ramp``````
Or you could just do:

Code:
``if b1 < b3 then Burner_Up_Ramp``
Which would have the same effect.

#### AllyCat

##### Senior Member
Hi,

Yes, as Pongo says: if b1 <= b3 - 1 then is not a valid syntax in PICaxe Basic (although it is in many other languages). The command reference defines only the conditions variable comparison value and variable comparison variable , but NOT variable comparison expression.

Cheers, Alan..

#### Pongo

##### Senior Member
Elegantly stated AC

#### Mark.R

##### Member
Ok, thanks for looking at this for me

#### hippy

##### Technical Support
Staff member
Code:
``````if b1 >= b3 then Temp_Check_1B
if b1 <= b3 - 1 then Burner_Up_Ramp``````
The first checks for "b1 >= b3" so, after that, you know that "b1 <= b3-1" must be true if it gets that far. So -
Code:
``````if b1 >= b3 then
goto Temp_Check_1B
else
goto Burner_Up_Ramp
end if``````

#### Mark.R

##### Member
Hippy another very helpful reply from you as always, thank you. Makes perfect sense now I've seen you logic.