BLHTML.org

BLHTML.org / Web Programming / BLHTML / BLHTML Manual / BLHTML funktion list / BLHTML funktion list /

 
  IF 3706 0
#IF# is an independent function
Rights to use this function #IF#:
  • BASIC

  • #IF# Look on one or compare two values with each other, if TRUE, executes then otherwise else executes. You must have at least one then or one else, nothing happens unless!

    • #IF(the if-case BLHTML executes)#
    • If #IF# contain strings:
      #IF($str == "is a string")# Quotation marks or apostrophes are needed only if the text contains spaces
    • then and else BLHTML executes
    values:  description:
    thenIf #IF# generates TRUE
    elseIf #IF# generates FALSE
    idThe current table is the default value
    Table where the value is retrieved for randomize
    rndRandomize a value from the selected table
    returnreturn=variable stores the results in $variable

    Operators to #IF#:
    values:  description:
    ==is equal to
    !=is inte equal to
    >=is greater / equal to
    <=is less / equal to
    >is greater than
    <is lesser then
    &&expression on both sides of && must be TRUE
    ||One of expression must be true to the next &&

    Example:
    #IF($variable)
            then(variable is set to $variable)
            else(variable has no value!)
    #

    // Checks if #DATA[variable]# has been declared with a value (is not NULL)

    #IF($variable != 8)
            then($variable is not eight)
            else($variable is actually eight)
    #

    // If #DATA[variable]# is a specific number?

    #IF(#SYSTEM[whoami]#) then(#HALT#)# // If logon then do not show web page

    Example, to randomize a post from a table:
    #IF($variable)
            id=24
            then(variable is $variable)
            else=rnd
    return=variable
    #


    /*
    If #DATA[variable]# is declared executes then
    If not randomize the key field from table 24 and return the value in #DATA[variable]# / $variable
    */

    Example, to compare two strings:
    #DATA[variable] post=set value(Compare strings)#

    #IF($variable == "Compare strings")
            then(then will be carried out in this example)
            else(#HALT#)
    #


    // If TRUE then execute then else datapage make a HALT.

    Manage GOTO GOSUB and RETURN from a IF:
    A<br>
    #IF(1)
    then(
            B<br>
            #$p=1#
            #: loop#
                    <b>p</b>(#$p#)
                    #SUM value($p 1) return=p#
            #IF($p <= 8) then(#GOTO loop#)#<br>
            C<br>
            #GOTO exit# // You can exit a IF but never GOTO, GOSUB into a IF
            D<br>
    )#

    E<br>
    #: exit#
    F<br>

    Returns:
    A
    B
    p(1) p(2) p(3) p(4) p(5) p(6) p(7) p(8)
    C
    F

    Example comparing multiple expression:
    /*
    IF(0 || 1 && 0 || 1) is equal to (0 || 1) && (0 || 1) the sentence is TRUE

    IF(1 && 0 || 0 == 0 || 0 || 0) is equal to (1) && (0 || 0 == 0 || 0 || 0) the sentence is TRUE (0 == 0 is TRUE)
    */

    NOTE BLHTML IF do not use brackets! BLHTML handles everything from && as an expression

    Example on other truths:
    TRUE && TRUE && TRUE to (TRUE) && (TRUE) && (TRUE)

    TRUE && FALSE || FALSE || TRUE || FALSE to (TRUE) && (FALSE || FALSE || TRUE || FALSE)

    More information:
  • #SWITCH#
  • #DO#
  • Assignment hierarchy with DATA
  • BLHTML syntax
  • Variable handling
  • BLHTML forum  


    apache MySQL PHP No to software patents! BLHTML
    © 2003, 2010 BLHTML
    This page is created with BLHTML in 0.0592 seconds