Page 1 of 1

Unexpected binary operator

Posted: 04 April 2010, 7:47 AM
by FFMan
this code seems to generate a compiler issue :-

Code: Select all

Sub Main()

 Dim a As Single
 
	debug.print "cor on "+fmt(a/100.0,4)
	
End Sub
forget how to put the code tags in - sorry

Re: Unexpected binary operator

Posted: 04 April 2010, 8:30 AM
by dkinzer
FFMan wrote:this code seems to generate a compiler issue
The compiler doesn't handle this case correctly. My first thought is that it should be flagged as an error.

In any event, either of the two forms below work correctly with the first being more efficient.

Code: Select all

Debug.Print "cor on "; Fmt(a / 100.0, 4)
Debug.Print "cor on " & Fmt(a / 100.0, 4)

Posted: 04 April 2010, 8:56 AM
by FFMan
thanks don - i raised it only because i thought it should be handled differently

i have corrected the code as you suggest and all is well.