So I am currently learning how to code using C++. I came across the following code below.
// =======================
// Lesson 2.4.3 - Do while
// =======================
#include<iostream>
using namespace std;
int main()
{
bool condition = false;
do
{
cout << "Enter a 0 to quit or 1 to continue: ";
cin >> condition;
}
while (condition);
}
Why is it that C++ automatically knows that 0 breaks the loop and that 1 continues the loop? Is it to do with a command knowing that 0 = false and that anything above is true? Thanks to those who can help.