else
Username:  
Password:
  > Home
> User Guide
v Reference
    > Introduction
    > CROFT
    > BEE Variables
    > BEE Syntax
    v BEE Commands
       > Variable Operations
       v Conditional
          o if
          o else
          o elseif
          o switch
          o case
          o hide
          o show
       > Loop
       > Module Calling
       > Remote Calling
       > Authentication
       > Data Access
       > Socket
       > Special Functions
    > Database Operation
    > Content Management
    > Objects and Classes
    > Interface with others
    o Glossary
> Portal Object
> Development Guide


Shortcuts
sys Class
debug Class
Intrinsic Conversions
>> Reference >> BEE Commands >> Conditional >> else <=  =>      <  1  >  
else – alternative execution block

BEE Script:   if (condition) statement;

            [else statement;]

or          if (condition) { statement; ... }

            [else { statement; ... }]

 

BEE Tag:     <beeif "condition">

                  tag

                  ...

            [<beeelse>

                  tag

                  ...]

            </beeif>

 

Note: The condition is surrounded by a small bracket and therefore is taken literally.  While you can (and sometimes need to) quote individual values in the condition, please do not quota the whole condition with double or single quote.  Otherwise, the whole condition will be taken as a string (and will most likely to be evaluated to true unless it is blank or 0).

The "if" command starts a conditional block structure and therefore an "else" or a sequence of "elseif" tags can follow the conditional block.

The condition will be evaluated for any BEE Variables before the truth value is determined.  Please note that variables are evaluated as macros and therefore one should bear in mind the logical expression syntax.  In particular, you need to quote strings as required:

Example:

var num = 2;

var item = 'water melon';

 

if ({num} > 10) display 'We got plenty';  // Valid

// The condition will evaluate to (2 > 10)

 

if ('{num}' > 10) display 'We got plenty';  // Valid

// The condition will evaluate to ('2' > 10), which is OK.

 

if ('{item}' == 'lemon') display "Can't eat them";  // Valid

// The condition will evaluate to ('water melon' == 'lemon').

 

if ({item} == 'lemon') display "Can't eat them";  // Invalid

// The condition will evaluate to (water melon == 'lemon').

 

If the condition is blank, it will evaluate to false.

After the "if" command is executed, the following BEE Variables are made available:

result%if:istrue

Set to 1 if the condition evaluates to true, or 0 otherwise

result%if:condition

Set to the condition after variable evaluation

Previous Page       Next Page

Accsoft Computer Technology Pty Ltd     ABN: 98 065 617 549
PO Box 892, Epping NSW 1710         Level 1, Epping Office Park, 242 Beecroft Rd, Epping NSW 2121, Australia
Tel: Sydney - (02)98691668     National - 1300-881668         Fax: (02)98691866
© Copyright 2003 Accsoft Computer Technology Pty Ltd