Skip to main content

Dynamic Typing

Soul is dynamically typed, meaning variables don’t need type declarations. The type is determined at runtime based on the assigned value.

Variable Declaration

Variables are created upon first assignment using the = operator:
Soul doesn’t use keywords like var, let, or const. Simply assign a value to create a variable.

Primitive Types

Numbers

Soul uses 64-bit floating-point numbers with high-precision decimal implementation to avoid common floating-point issues:

Strings

Strings are UTF-8 encoded and can use three different quote styles:

Booleans

Boolean values are true or false:

Null

Represents the intentional absence of a value:

Type Checking

Use built-in functions to check types at runtime:

Type Conversion

Soul provides functions for explicit type conversion:

Variable Scope

Variables follow lexical scoping rules:
Soul doesn’t have block-scoped variables like JavaScript’s let and const. Variables are function-scoped.

Best Practices

Use Descriptive Names

Initialize Variables