fixed bug and added a little documentation

This commit is contained in:
Francesco Cozzuto
2021-11-05 00:10:45 +01:00
parent b224f57361
commit 9458632b27
8 changed files with 298 additions and 20 deletions
+38
View File
@@ -0,0 +1,38 @@
# ------------------------------------------------------------------------- #
# --- Loops --------------------------------------------------------------- #
#
# Looping constructs are available in the form of while and do-while
# statements. The while statement checks the condition before each
# iteration:
i = 0;
while i < 10:
i = i + 1;
# This loop runs for 10 times. As for the if-else statement, a single
# statement is expected as the body of the while statement. You can
# provide it a compound statement tho.
i = 0;
while i < 10:
{
print('While iteration no. ', i, '\n');
i = i + 1;
}
# The do-while statement checks the condition at the end of each
# iteration. This means that at least one iteration is performed!
i = 0;
do
{
print('Do-while iteration no. ', i, '\n');
i = i + 1;
}
while i < 10;
#
# ------------------------------------------------------------------------- #
# ------------------------------------------------------------------------- #