Skip to content

Commit

Permalink
Add While statement snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
derarion committed Jul 16, 2024
1 parent 0b25b6b commit 3122bde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const snippets: Snippet[] = [
label: "For Statement",
code: `for(var i = 0; i < 10; i = i + 1) {\n if (i == 3) {\n continue; // Move on to the next iteration\n }\n\n print(i);\n\n if (i == 7) {\n break; // Break out of the loop\n }\n}\n`,
},
{
key: "whileStatement",
label: "While Statement",
code: `var x = 0;\n\nwhile(x < 10) {\n x = x + 1;\n if (x == 3) {\n continue; // Move on to the next iteration\n }\n\n if (x == 7) {\n break; // Break out of the loop\n }\n\n print(x);\n}\n`,
},
{
key: "array",
label: "Array",
Expand Down
1 change: 1 addition & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type SnippetKey =
| "functionDeclarationAndCall"
| "ifStatement"
| "forStatement"
| "whileStatement"
| "blockScope"
| "lexicalScoping"
| "recursiveFunction";

0 comments on commit 3122bde

Please sign in to comment.