mirror of https://github.com/sveltejs/svelte
parent
0319bc1085
commit
41793b6694
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
let x = 7;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if x > 10}
|
||||||
|
<p>{x} is greater than 10</p>
|
||||||
|
{:else}
|
||||||
|
{#if 5 > x}
|
||||||
|
<p>{x} is less than 5</p>
|
||||||
|
{:else}
|
||||||
|
<p>{x} is between 5 and 10</p>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
let x = 7;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if x > 10}
|
||||||
|
<p>{x} is greater than 10</p>
|
||||||
|
{:else if 5 > x}
|
||||||
|
<p>{x} is less than 5</p>
|
||||||
|
{:else}
|
||||||
|
<p>{x} is between 5 and 10</p>
|
||||||
|
{/if}
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
title: Else-if blocks
|
||||||
|
---
|
||||||
|
|
||||||
|
Just like in JavaScript, we can 'chain' related conditional blocks together:
|
||||||
|
|
Loading…
Reference in new issue