• My Pages
  • Comments
  • Add Link
  • Subscribe
  • Subscribe User
  • Edit (GUI)
  • Edit (Text)
  • Rename Page
  • Copy Page
  • Load Page
  • Save Page
  • Delete Page
  • Attachments
  • Check Spelling
  • Diffs
  • Info
  • Revert to this revision
  • XML
  • Render as Docbook
  • Print View
  • Raw Text
  • Delete Cache
  • Like Pages
  • Local Site Map
  • Remove Spam
  • Package Pages
  • Sync Pages
    • Diff for "Operators"
    Differences between revisions 5 and 6
    Revision 5 as of 2012-12-04 18:33:12
    Size: 3358
    Editor: Inanna
    Comment:
    Revision 6 as of 2013-12-08 20:40:12
    Size: 3377
    Editor: Inanna
    Comment:
    Deletions are marked like this. Additions are marked like this.
    Line 79: Line 79:
    ScriptSyntax ----
    CategoryScriptingLanguage

    The following symbols are characters that specify how to combine, compare, or modify the values of an expression. These will be used in performing math operations, setting variables, and comparing operators or variables in conditional statements (ifgoto, ifgosub).

    Arithmetic

    Symbol

    Name

    Description

    +

    addition

    Adds numeric expressions.

    --

    decrement

    Subtracts 1 from the operand. ** Not implemented yet

    /

    division

    Divides expression1 by expression2.

    ++

    increment

    Adds 1 to an expression. ** Not implemented yet

    MOD

    modulo

    Calculates the remainder of expression1 divided by expression2.

    *

    multiplication

    Multiplies two numerical expressions.

    -

    subtraction

    Used for negating or subtracting.

    Comparison

    Symbol

    Name

    Description

    ==

    equality

    Tests two expressions for equality.

    >

    greater than

    Compares two expressions and determines whether expression1 is greater than expression2; if it is, the result is true.

    >=

    greater than or equal to

    Compares two expressions and determines whether expression1 is greater than or equal to expression2 (true) or expression1 is less than expression2 (false).

    !=

    inequality

    Tests for the exact opposite of the equality (==) operator.

    <

    less than

    Compares two expressions and determines whether expression1 is less than expression2; if so, the result is true.

    <=

    less than or equal to

    Compares two expressions and determines whether expression1 is less than or equal to expression2; if it is, the result is true.

    Assignment

    Symbol

    Name

    Description

    =

    assignment

    Assigns the value of expression2 (the operand on the right) to the variable, array element, or property in expression1.

    String

    Symbol

    Name

    Description

    +

    concatenation

    Concatenates (combines) strings.

    "

    string delimiter

    When used before and after characters, indicates that the characters have a literal value and are considered a string, not a variable, numerical value, or other element.

    Examples:

    Arithmetic

    // Math!
    myVar=2
    echo 10 * myVar
    
    Result:
    17:49:02 20
    17:49:03 Script stopped

    Comparison

    // Testing two numbers using comparison
    ifgoto (1 != 2) doesnot
    echo "They are equal!"
    end
    
    label doesnot
    echo "They are not equal!"
    end
    
    Result:
    17:25:54 They are not equal!
    17:25:55 Script stopped

    Assignment

    //Setting a variable called myVar and giving it a value of 1.
    myVar=1
    echo "My variable is " + myVar
    
    Result:
    17:47:31 My variable is 1
    17:47:32 Script stopped

    String

    //Combine two strings together to form a greeting
    myVar="Hello"
    myVar2=" there!"
    echo myVar + myVar2
    
    Result:
    17:56:38 Hello there!
    17:56:39 Script stopped



    CategoryScriptingLanguage

    Operators (last edited 2018-01-02 11:35:32 by LKD70)