Skip to content

If-Else

If or If - Else provides conditional code execution.
First of all construction compiles condition and branching between code blocks.

Syntax

if CONDITION { code };
if CONDITION { code } else { code };

Examples

tpl-lang
if 5 < 10 {
  print("right!");
} else {
  print("what? ._.");
}

right!


tpl-lang
If 10 > 5 {
  print("why??")
} else {
  print("okay");
}

okay