Page 1 of 1
Immediate IF() syntax error
Posted: Tue Jun 11, 2013 1:25 am
by toyet
Any ideas why the red line below produces a syntax error at '('
nEmployeeMax := 33
nEmployeeCount := 0
nPageE := int(nEmployees/nEmployeeMax) + if(nEmployees % nEmployeeMax > 0, 1, 0 )
nPageC := 0
Fivewin 13.04 / Harbour 3.2.0 (rev 18881)
Thanks for any help.
Toyet
Re: Immediate IF() syntax error
Posted: Tue Jun 11, 2013 2:13 am
by nageswaragunupudi
If you are meaning "syntax error" while compiling, there is no such error. The statement is compiling fine for me.
If you are meaning runtime error ( i don't think that is what you meant) then please check nEmployees in already initialized with a numeric value.
Finally, the statement
Code: Select all
nPageE := int(nEmployees/nEmployeeMax) + if(nEmployees % nEmployeeMax > 0, 1, 0 )
can be simplified as
Code: Select all
nPageE := Ceiling(nEmployees/nEmployeeMax)
Re: Immediate IF() syntax error
Posted: Tue Jun 11, 2013 3:00 am
by toyet
GN Rao,
I tried the Ceiling() function and it seems to go fine. Thank you for it.
Maybe the '%' operator for modulus division is the culprit for the error?
Toyet
Re: Immediate IF() syntax error
Posted: Tue Jun 11, 2013 5:55 am
by nageswaragunupudi
% operator works well with both Harbour and xHarbour with all recent versions I remember.