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") +``` +