Data Types

DWScript is a strongly-typed language, meaning every variable and expression has a specific type known at compile time. This ensures better performance, safety, and tooling support.

Core Primitives

These are the fundamental building blocks of most scripts.

  • Integers: 64-bit signed whole numbers.
  • Floats: 64-bit double-precision floating-point numbers.
  • Booleans: Logical True or False values.
  • Strings: Unicode (UTF-16) sequences of characters.

Structural Types

Types used to organize and group data.

  • Arrays: Ordered collections of a single type (Static or Dynamic).
  • Associative Arrays: Key-value maps (dictionaries).
  • Records: Lightweight value-type structures.
  • Classes: Full-featured object-oriented reference types.
  • Enums & Sets: Named constants and bitfield collections.

Specialized Types

DWScript includes specialized types for specific domains or dynamic behavior.

  • Variants: Highly dynamic types that can hold any value.
  • Big Integers: Arbitrary-precision whole numbers.
  • Binary Data: Raw byte buffers for I/O and crypto.
  • File Handles: Handles for low-level file system operations.

Type Casting & Conversion

DWScript provides several ways to move data between types:

  1. Implicit Conversion: For safe operations, like assigning an Integer to a Float.
  2. Explicit Casting: Using the Type(Value) syntax for potentially unsafe conversions.
  3. Method Helpers: Using .ToString, .ToInt, etc., for semantic conversions.
var i: Integer := 10;
var f: Float := i;       // Implicit
var s: String := i.ToString; // Helper method

Identifiers

DWScript is fully Unicode-aware. You can use Unicode characters in variable names, function names, and other identifiers.

var ÿ := 'Unicode variable';
PrintLn(ÿ);
Result
Unicode variable
On this page