Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let count = 0;

$: if (count >= 10) {
alert(`count is dangerously high!`);
alert('count is dangerously high!');
count = 9;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ title: Statements
We're not limited to declaring reactive *values* — we can also run arbitrary *statements* reactively. For example, we can log the value of `count` whenever it changes:

```js
$: console.log(`the count is ${count}`);
$: console.log('the count is ' + count);
```

You can easily group statements together with a block:

```js
$: {
console.log(`the count is ${count}`);
alert(`I SAID THE COUNT IS ${count}`);
console.log('the count is ' + count);
alert('I SAID THE COUNT IS ' + count);
}
```

You can even put the `$:` in front of things like `if` blocks:

```js
$: if (count >= 10) {
alert(`count is dangerously high!`);
alert('count is dangerously high!');
count = 9;
}
```