KScript docs
EN

Playground

The playground runs scripts on your computer, so it needs kscript docs. This copy of the docs was written by kscript docs --export-to to read offline.

Run kscript docs to open the docs with the playground, and with a Run button on every example.

<let name="name" value="'World'" />
<echo>Hello, $name!</echo>

<let name="people" value="[{ name: 'Joan', age: 82 }, { name: 'Sam', age: 35 }]" />
<for each="p" in="$people->sort(by: fn(p) => $p.age)">
  <echo>{ $p.name } is { $p.age }</echo>
</for>
$name = 'World'
echo "Hello, { $name }!"

$people = [{ name: 'Joan', age: 82 }, { name: 'Sam', age: 35 }]
for p in $people->sort(by: fn(p) => $p.age) {
  echo "{ $p.name } is { $p.age }"
}