infinite loop not infinite

The following loop works as expected: infinite looping:
1
2
3
4
5
6
bool loop = true;
	while (loop)
	{
		std::cout << "Infinite Loop" << std::endl;
	}
	


the following does not; it hits loop broken immediately. Can someone why this loop isn't working?
1
2
3
4
5
6
7
8
bool loop = true;

if (loop == true)
	{
		std::cout << "Infinite loop" << std::endl;
	}

	std::cout << "loop broken" << std::endl;
Last edited on
The second isn't a loop. It's an if statement.
It seems incredible that you don't know this after 554 posts.
Last edited on
Lol simple mistake. Brain farts happen to all of us, OP.
Last edited on
Topic archived. No new replies allowed.