We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0be3ba6 commit e769f03Copy full SHA for e769f03
documentation/docs/03-template-syntax/03-each.md
@@ -74,6 +74,30 @@ You can freely use destructuring and rest patterns in each blocks.
74
{/each}
75
```
76
77
+## Each blocks without an item
78
+
79
+```svelte
80
+<!--- copy: false --->
81
+{#each expression}...{/each}
82
+```
83
84
85
86
+{#each expression, index}...{/each}
87
88
89
+In case you just want to render an item `n` times, you can omit the `as` part
90
91
92
+{#each { length: 10 }}
93
+ <li>I am rendered 10 times</li>
94
+{/each}
95
96
+{#each array, index}
97
+ <li>I am item number {index}</li>
98
99
100
101
## Else blocks
102
103
```svelte
0 commit comments