Fandom

Scratchpad

A bit more complicated

216,259pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

/* This is a 
multi-line comment */

// Declare a variable of type Object
Object o

// Assign each Object in the current Module to o
for o in current Module do {
    
    // Declare a variable of type string
    string objectText
    
    // Put the Object's Object Text into the string variable
    objectText = o."Object Text"
    
    // If the text contains a shall, print the Absolute Number of the object
    if matches("shall", objectText) then print o."Absolute Number" "\n"
}

The syntax of DXL has a slight resemblance to C and C++ but there are important differences, for example:

  • There is no need to end each statement with a semi-colon
  • The use of parentheses is often not required
  • There is no need for a 'main()' function

The code above demonstrates:

  1. Declaration of variables (o and objectText)
  2. A 'for' loop that is repeated for all visible Objects in the current Module
  3. Accessing the contents of an Object's Attributes ("Object Text" and "Absolute Number")
  4. A call to a DXL function (matches)
  5. A conditional statement (if) that performs an action if a condition is met

All of this will be examined in more detail elsewhere in this wiki

Also on Fandom

Random wikia