Scratchpad

If you are new to Scratchpad, and want full access as a Scratchpad editor, create an account!
If you already have an account, log in and have fun!!

READ MORE

Scratchpad
Register
Advertisement
/* 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

Advertisement