as long as boolean is true do something

I am looking for an easy way to do something as long as an boolean is true:

as long as (boolean == true)
//do something;

That should work in a simmilar way to

//do something;

So as soon as the boolean changes to false “something” should no longer be done :smiley:

I hope I made it clear,

Thanks for any help

if(bool) {
//do something