Skip to content

Commit 4bb2ad3

Browse files
author
Rich Harris
committed
.
1 parent 87ba390 commit 4bb2ad3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

content/tutorial/01-svelte/04-logic/03-else-if-blocks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Multiple conditions can be 'chained' together with `else if`:
88
/// file: App.svelte
99
{#if x > 10}
1010
<p>{x} is greater than 10</p>
11-
{:+++else if+++ 5 > x}
11+
{:+++else if+++ x < 5}
1212
<p>{x} is less than 5</p>
1313
{:else}
1414
<p>{x} is between 5 and 10</p>

content/tutorial/01-svelte/04-logic/03-else-if-blocks/app-a/src/lib/App.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<script>
2-
let x = 7;
2+
let x = 0;
33
</script>
44

5+
<button on:click={() => x += 1}>+1</button>
6+
57
{#if x > 10}
68
<p>{x} is greater than 10</p>
79
{:else}
8-
{#if 5 > x}
10+
{#if x < 5}
911
<p>{x} is less than 5</p>
1012
{:else}
1113
<p>{x} is between 5 and 10</p>

content/tutorial/01-svelte/04-logic/03-else-if-blocks/app-b/src/lib/App.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<script>
2-
let x = 7;
2+
let x = 0;
33
</script>
44

5+
<button on:click={() => x += 1}>+1</button>
6+
57
{#if x > 10}
68
<p>{x} is greater than 10</p>
7-
{:else if 5 > x}
9+
{:else if x < 5}
810
<p>{x} is less than 5</p>
911
{:else}
1012
<p>{x} is between 5 and 10</p>

0 commit comments

Comments
 (0)