From 6b4644efdbad4b06e9eafa9d812bacb31bcdeeb0 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:37:44 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- flow/examples/README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/flow/examples/README.md b/flow/examples/README.md index e438620..1654764 100644 --- a/flow/examples/README.md +++ b/flow/examples/README.md @@ -73,7 +73,7 @@ print(c) start([Start]) --> initcounter{{"counter ← 0"}} --> initcountermax{{"counter_max ← 100"}} --> Condition{"counter < counter_max"} Condition -- Yes --> printcounter[/"print counter"/] --> Action["counter ← counter + 1"] Action --> Condition - Condition -- No --> End(End) + Condition -- No --> stop([Stop]) {% endraw %} @@ -95,3 +95,29 @@ while counter < counter_max: counter += 1 ``` +## if, elif, else + +{% raw %} +
+ flowchart TD + start([Start]) --> inputa[/"Input integer a"/] --> Condition1{"a < 1"} + Condition1 -- Yes --> print1[/"print condition 1"/] + Condition1 -- No --> Condition2{"a == 2"} + Condition2 -- Yes --> print2[/"print condition 2"/] + Condition2 -- No --> print3[/"print condition else"/] + Action1 --> stop([Stop]) + Action2 --> stop + ElseAction --> stop ++{% endraw %} + +```python +a = int(input()) +if a < 1: + print("condition 1") +elif a == 2: + print("condition 2") +else: + print("condition else") +``` +