When browsers treat the markup as XML:
<script>
<![CDATA[
...code...
]]>
</script>
When browsers treat the markup as HTML:
<script>
...code...
</script>
When browsers treat the markup as HTML and you want your XHTML 1.0 markup (for example) to validate.
<script>
//<![CDATA[
...code...
//]]>
</script>