From 3d5327206250fb294e0e4f7230603494467c320a Mon Sep 17 00:00:00 2001 From: jakasulthon Date: Thu, 17 Feb 2022 01:40:14 +0700 Subject: [PATCH] Add dynamic condition result example I added the dynamic condition result example. It would be nice to showing this basic example on the tutorial, Svelte can do many things that is easy to understand even with the beginner. --- .../04-logic/03-else-if-blocks/text.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/site/content/tutorial/04-logic/03-else-if-blocks/text.md b/site/content/tutorial/04-logic/03-else-if-blocks/text.md index 18faeacfe6..752c430d21 100644 --- a/site/content/tutorial/04-logic/03-else-if-blocks/text.md +++ b/site/content/tutorial/04-logic/03-else-if-blocks/text.md @@ -12,4 +12,24 @@ Multiple conditions can be 'chained' together with `else if`: {:else}

{x} is between 5 and 10

{/if} -``` \ No newline at end of file +``` + +Also, you can add some increment function to variable `x` so it will dynamically change the condition output. + +Add the `Add number` button with event function `incrementNumber`: + +```html + +``` +Change variable `x` to increment itself inside the function `incrementNumber`: + +```js +function incrementNumber() { + x += 1; +}; +``` + +Voila! Now you can see the condition output changes as `Add number` constantly clicked. +