Statements (conditionals)
// What the user types
$: if (test > 10 && color.get() !== color.get_last()) {
color.set('color: green');
}
// What the compiler outputs to JS
test.subscribe((new_val, old_val) => {
if (new_val > 10 && color.get() !== color.get_last()) {
color.set('color: green');
}
})
Declarations
// What the user types
$: is_greater_than = test > 30;
// What the compiler outputs to JS
let is_greater_than = variable(test > 30);
test.subscribe((new_val, old_val) => {
is_greater_than.set(test > 30);
})