KScript documentação
PT

Idioma

Traduzido automaticamente do inglês, que é a versão original.

Primeiros passos

Funções

<fn name="greet" params="who: string, greeting = 'Hello'">
  <return value="$greeting + ', ' + $who + '!'" />
</fn>
<fn name="square" params="n: number" value="$n * $n" />

<echo>{ @greet('World') }</echo>
<echo>{ @greet('Kyle', greeting: 'Hi') }</echo>
<echo>{ 7 |> @square() }</echo>
fn greet(who: string, greeting = 'Hello') {
  return $greeting + ', ' + $who + '!'
}
fn square(n: number) => $n * $n

echo "{ @greet('World') }"
echo "{ @greet('Kyle', greeting: 'Hi') }"
echo "{ 7 |> @square() }"

Suas próprias funções e os comandos integrados são chamados com @. Os argumentos podem ser nomeados, como greeting: 'Hi'.

Edit this page on GitHub