I saw one example
int x = 10;
int y = 5;
bool isGreater = x > y;
printf("%d", isGreater);
But I could write this
int x = 10;
int y = 5;
printf("%d", x > y);
I am a complete beginner and I have no real reason why I would or would not want to deal with boolean variables, but I want to understand their raison d’être.
Edit: typo city


Sometimes you need to store a value that is either true or false and refer to it later or maybe update it. Maybe you have some complicated logic for when a loop needs to end that you can’t really represent in the while condition. You can make the while check your bool variable and then set it to false when you are ready to end. Perhaps you have a function that returns a bool value and you setup your logic so there is a default return value but you do some calculations and sometimes you want to return the other value. it lets you have a single return statement in the function which can be easier to read.
You use boolean variables in the same way as other variables. The example you share is indeed contrived. In that situation you need no variables at all. That example is merely showing the syntax.
Thank you for the explanation! Perhaps at my novice level, I should just go with it and learn the use of bool as I experience it. :)