KScript docs
EN

Getting started

Packages

Everything above is KScript.Core, which every script has. The rest comes in packages you import: files and folders, the terminal, maths, HTTP, web pages, desktop windows and more. See the package list.

<import package="KScript.Math" as="math" />
<import package="KScript.IO" />

<echo>√2 is { @math.sqrt(2)->round(digits: 4) }</echo>

<do>@write_text(./notes.txt, 'Buy milk')</do>
<echo>notes.txt says: { @read_text(./notes.txt) }</echo>
import KScript.Math as math
import KScript.IO

echo "√2 is { @math.sqrt(2)->round(digits: 4) }"

@write_text(./notes.txt, 'Buy milk')
echo "notes.txt says: { @read_text(./notes.txt) }"

Examples in the docs run in their own empty folder, so writing files here is safe.

Edit this page on GitHub