summaryrefslogtreecommitdiff
path: root/5p2.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-08-29 13:27:45 +0200
committerOskar <[email protected]>2024-08-29 13:27:45 +0200
commit743c47c671347a0ac0f8f64b7117b48c65bab073 (patch)
tree5e33efe7a3e4d6ba5a9a6ee34762e978b51cb6b3 /5p2.cpp
parent1208defdbc457a89c0d9aea3b8faf86b8492761f (diff)
more
Diffstat (limited to '5p2.cpp')
-rw-r--r--5p2.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/5p2.cpp b/5p2.cpp
new file mode 100644
index 0000000..ce158c9
--- /dev/null
+++ b/5p2.cpp
@@ -0,0 +1,23 @@
+#include <iostream>
+
+/*
+ *
+ * 5.2
+ *
+ *
+ */
+
+int main () {
+
+ // A block is when we need to do multiple statements for example within a loop (which only requires 1)
+ // A block is also useful to contain objects in a certain scope and such.
+ int i = 0;
+ int j = 0;
+ while(i != 100) { // Start of block
+ ++i;
+ j = i * 2;
+ } // end of block
+
+ std::cout << i << " " << j << std::endl;
+ return 0;
+}