Declaration tags define local variables inside markup with `const` or `let`: ```svelte {#each boxes as box} {const area = box.width * box.height} {const label = `${box.width} ⨉ ${box.height} = ${area}`}

{label}

{/each} ``` > [!NOTE] The [`{@const ...}`](@const) syntax is considered legacy — use declaration tags instead. When values should be reactive, you can use `$state` and `$derived`: ```svelte

Hello {user.name}

{#if editing} {let name = $state(user.name)} {const greeting = $derived(`Hello ${name}`)}

{greeting}

{/if} ``` Declaration tags can be used anywhere inside the component. They can reference values declared outside themselves (for example in the `