Firstly the break statement will cause the flow to exit the while loop, so essentially the block will only be done
once. You should only use loops if you're going to repeat some task, otherwise use a simple if statement.
This is equivalent to:
if(sf::Event::KeyReleased)
{
if(event.key.code == sf::Keyboard::Escape)
isPaused = true;
}
Now, another issue is the outer if statement itself. You probably thought that it checks if a key has been released, it does not. sf::Event::KeyReleased is just an enum which are named integers values. Integers (and enums), can be converted to bool. I will presume that sf::Event::KeyReleased will be converted to true in a boolean context. So essentially the code is equivalent to this.
if(true)
{
if(event.key.code == sf::Keyboard::Escape)
isPaused = true;
}
As you can now see, if(true) is quite pointless, so it is the same as this.
if(event.key.code == sf::Keyboard::Escape)
isPaused = true;
Yes, these 2 lines are identical to the old version which is right below for comparison.
while(sf::Event::KeyReleased)
{
if(event.key.code == sf::Keyboard::Escape)
isPaused = true;
break;
}
As you can see our simplified version is much more clearer, and not misleading.