Language Overview

DWScript is an object-oriented scripting language based on Delphi (Object Pascal). It features a strong type system, high performance, and a rich standard library. This guide is organized into the following sections:

1. Getting Started

2. Types & Variables

3. Operators

4. Control Flow

  • Loops - for, while, and repeat loops.
  • Conditionals - if statements and case blocks.
  • Iteration - Iterating over collections and ranges.
  • Exceptions - Error handling with try...except and try...finally.

5. Data Structures

6. Functions

  • Subroutines - Procedures and functions.
  • Parameters - Passing values, constants, and references.
  • Contracts - Design-by-contract features (requires/ensures).
  • Lambdas - Anonymous functions and closures.

7. Object Oriented Programming

8. Files & System

9. Web & Database

  • Web Support - Handling HTTP requests and responses.
  • JSON - Parsing and generating JSON.
  • Database - SQL integration.

10. Advanced Topics

Gotcha: Remember that while Arrays in DWScript are 0-indexed (starting at 0), Strings are 1-based (starting at 1) to maintain compatibility with classic Pascal. Use s[1] to access the first character of string s.

On this page