Skip to main content
For a comprehensive introduction to Pkl, check out our Pkl primer, which covers the fundamentals in just a few minutes. For more in-depth documentation, see the official Pkl language tutorial.

Basic syntax

Comments

Module declaration

Importing modules

Variables and assignments

Objects

Amendments

Data types

Numbers

Booleans

Strings

Durations

Data sizes

Null

Collections

Classes and objects

Class definition

Instantiation

Type constraints

Operators

Control flow

If expression

For generators

When generators

Let expression

Functions and methods

Function definition

Method in class

Calling functions and methods

Standard library modules

The standard library is imported with import "pkl:<module>".

Error handling and validation

Throw

Constraints