Question · Svelte and SvelteKit course · Module 6: Template Logic

Conditional Block

What is the correct syntax for a conditional block in Svelte?

Answer options

  • {% if condition %}...{% endif %}
  • {#if condition}...{/if}
  • <if condition>...</if>
  • @if(condition) {...}

You can check the correct answer by solving this task in the CodeWorlds game.