Products and Services
 
Loading ...
 
I've forgotten my password.
  User ID or Email Address:
  Password:
      to    
    check my account
    read my email
    anti-spam
    usage report
    sign up for a new user

Please enter your Username and Password before clicking the above links.
  >> Products >> BEE Web Platform >> Developer >> Programming       <=  =>      <  1  2  3  4  5  6  >   To quote or not to quote

As mentioned in the previous page, all BEE Commands can be presented in two semantically equivalent syntaxes.  This is the same for variable assignments:

<beevar var=a value="hello world">
or
<script language="bee">
var a = "hello world";
</script>

As with HTML tag attributes, quotation marks are required only if the attribute value got spaces in it.  Otherwise, it is perfectly OK not to use quotation marks:

<bee var=a value=hello>
or
<script language=bee>
a = hello;
</script>

However, this create an ambiguity in variable assignment syntax in BEE Script.  What if "hello" is a variable name?  In that case, the value needs to be preceded by "(var)".

<bee var=hello value='Good morning'>
<bee var=a value=(var)hello>
or
<script language=bee>
hello = 'Good morning';
a = (var)hello;
</script>

After the above, both variables ("hello" and "a") contain "Good morning".

By the way, single and doulbe quotation marks can be used interchangably (but needs to be in pair).  For example, "It's great!" and 'It\\'s great!' are equivalent.  Also, excessive quotation marks are simply ignored and won't cause any troubles:

<bee var=hello value="Good morning">
<bee var=a value="(var)hello">
or
<script language=bee>
hello = "Good morning";
a = "(var)hello";
</script>

Back   Next   


Print     <=  =>      <  1  2  3  4  5  6  >  
Read my email