FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Immediate IF() syntax error
Posts: 39
Joined: Thu Apr 05, 2007 12:52 AM
Immediate IF() syntax error
Posted: Tue Jun 11, 2013 01:25 AM
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
Thanks,

Toyet Amores

-----------------------------------------------------------------------

xHarbour/Fivewin/Harbour/BCC582/DBMS:Oracle/MySQL

-----------------------------------------------------------------------
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Immediate IF() syntax error
Posted: Tue Jun 11, 2013 02:13 AM
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 (fw): Select all Collapse
nPageE := int(nEmployees/nEmployeeMax) + if(nEmployees % nEmployeeMax > 0, 1, 0 )

can be simplified as
Code (fw): Select all Collapse
nPageE := Ceiling(nEmployees/nEmployeeMax)
Regards



G. N. Rao.

Hyderabad, India
Posts: 39
Joined: Thu Apr 05, 2007 12:52 AM
Re: Immediate IF() syntax error
Posted: Tue Jun 11, 2013 03:00 AM

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

Thanks,

Toyet Amores

-----------------------------------------------------------------------

xHarbour/Fivewin/Harbour/BCC582/DBMS:Oracle/MySQL

-----------------------------------------------------------------------
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Immediate IF() syntax error
Posted: Tue Jun 11, 2013 05:55 AM

% operator works well with both Harbour and xHarbour with all recent versions I remember.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion