PDA

View Full Version : Logical AND operator


sandman
02-13-2003, 04:43 PM
Hi,

What is the logical AND operator in laszlo? I am
using '&&' in the following code and get an error.

if ((x1 > charm_topleft_x) && (x1 < charm_bottomright_x) && (y1 > charm_topleft_y) && (y1 < charm_bottomright_y))
{
Debug.write("on top");
}

The error:
Error: draggablewindow.lzx:39:40: The entity name must immediately follow the '&' in the entity reference

thanks,
Sandeep.

antun
02-13-2003, 04:53 PM
Hey Sandeep

You have the right idea (&& is the logical and operator), and you're right that < and > should be &lt; and &gt; respectively, but remember an ampersand (&) is also a special character in XML. It's code is &amp;

If you're doing that many special characters, it's better to use the CDATA tag to enclose everything:-


<canvas>
<script>
<![CDATA[
if ((x1 > charm_topleft_x) && (x1 < charm_bottomright_x) && (y1 > charm_topleft_y) && (y1 < charm_bottomright_y))
{
Debug.write("on top");
}
]]>
</script>
</canvas>


-Antun