From 743c47c671347a0ac0f8f64b7117b48c65bab073 Mon Sep 17 00:00:00 2001 From: Oskar Date: Thu, 29 Aug 2024 13:27:45 +0200 Subject: more --- 5p2.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 5p2.cpp (limited to '5p2.cpp') 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 + +/* + * + * 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; +} -- cgit v1.2.3