Skip to content

seanpm2001/Learn-Svelte


/Svelte_Logo.svg

Learning Svelte (programming language)

I know very little about the Svelte programming language. This document will go over all of my knowledge of the Svelte programming language.

Hello World in Svelte

This is how you make a normal Hello World program in Svelte:

<script>
    let hw = "Hello World"
</script>

/!\ This example has not been tested yet, and may not work

Comments in Svelte

Comments in Svelte are the same as in languages like HTML.

Single line comments

Single line comments in Svelte are written like so:

<!-- This is a single line comment in Svelte !-->
Multi-line comments

Multi-line comments are the same, just more spread out. It can be written like so:

<!-- This is
a multi-line
comment in
svelte !-->

Break keyword in Svelte

Svelte does not support the break keyword.

Executing a script in Svelte

This is how you return scripts in Svelte.

<script>
    let script1 = "Test successful"
</script>
<p> {script1}!</p>

/!\ This example has not been tested yet, and may not work

Other knowledge of the Svelte programming language

  1. Svelte is a language by Rich Harris

  2. Svelte is not a semicolon and curly bracket language

  3. Svelte uses the *.svelte file extension by default. I don't know if it uses any other file extensions.

  4. Svelte is an extension to JavaScript

  5. Svelte is written in TypeScript

  6. Svelte was created in 2016

  7. Svelte is not one of the top 50 programming languages (as of 2022, July 31st, it has never ranked 50 or higher on the TIOBE index, and it has not ranked in the top 100) source: TIOBE index

  8. Svelte is a language recognized by GitHub (as of 2022, Tuesday, August 2nd)

  9. No other knowledge of the Svelte programming language

Additional comments

  1. I have not yet memorized the names of the developer

  2. No other additional comments available


File info

File type: Markdown document (*.md *.mkd *.mdown *.markdown)

File version: 1 (2022, Tuesday, August 2nd at 8:07 pm PST)

Line count (including blank lines and compiler line): 145


File history

Click/tap here to expand/collapse the history for this file

Version 1 (2022, Tuesday, August 2nd at 8:07 pm PST)

Changes:

  • Started the file
  • Added the title section
  • Added the Hello World in Svelte section
  • Added the Comments in Svelte section
  • Added the Single line comments subsection
  • Added the Multi-line comments subsection
  • Added the break keyword in Svelte section
  • Added the Executing a script in Svelte section
  • Added the other knowledge of the Svelte programming language section
  • Added the Additional comments section
  • Added the file info section
  • Added the file history section
  • No other changes in version 1