KScript docs
EN

Getting started

The .kscript format and XML

Everything above can also be written as XML, which looks like HTML: $name = 'Joan' is <let name="name" value="'Joan'" />, and echo "Hi" is <echo>Hi</echo>. Switch any example to XML to see it, or use the switch at the top of the page. XML scripts end in .ks.xml, and the two kinds can import each other.

<let name="people" value="[{ name: 'Joan', age: 82 }, { name: 'Sam', age: 35 }]" />
<for each="p" in="$people">
  <if $p.age > 40>
    <echo>{ $p.name } is over 40</echo>
    <continue />
  </if>
  <echo>{ $p.name } is { $p.age }</echo>
</for>
$people = [{ name: 'Joan', age: 82 }, { name: 'Sam', age: 35 }]
for p in $people {
  if $p.age > 40 {
    echo "{ $p.name } is over 40"
    continue
  }
  echo "{ $p.name } is { $p.age }"
}

kscript convert turns a file into the other format. More in the .kscript format.

Edit this page on GitHub