diff --git a/walross/loop.py b/walross/loop.py new file mode 100644 index 0000000..da719f6 --- /dev/null +++ b/walross/loop.py @@ -0,0 +1,10 @@ +# Ohne Walross-Operator +n = 0 +while n < 10: + n += 1 + print(n) + +# Mit Walross-Operator +n = 0 +while (n := n + 1) <= 10: + print(n) diff --git a/walross/simple_loop.py b/walross/simple_loop.py new file mode 100644 index 0000000..5d67a91 --- /dev/null +++ b/walross/simple_loop.py @@ -0,0 +1,10 @@ +# Ohne Walross-Operator +n = 0 +while n < 10: + n += 1 + print(n) + +# Mit Walross-Operator +n = 0 +while (n := n + 1) < 10: + print(n)