A somewhat different way of doing things,

image Anyone think this’ll cause some problems?

2 Likes

image

I did something similar. This seems simpler than creating an additional Boolean to accomplish the same thing.

Did the same but slightly different. feel like changing the bool to Wantstoplayagain as feel like it will read better.
Capture

1 Like

do
{

	PrintIntro();
	// loop for  the number of turns asking for guesses
	PlayGame();
    }

while(AskToPlayAgain());

p.s : this works too right i tested it works the same becz its a boolean if it returns true it will play again and then if false then will not play but i think how video showed is the better and clearer way of doing things

I did the same, I’am just learning, so I can’t say if its messy or not, nut it doesn’t seems to be

just to follow upon this, Ahmed is exactly correct – the AskToPlayAgain function will always return a boolean value, so there’s no need to compare it to something. For the record, here’s my code:

do
{
    PrintIntro();
    PlayGame();
}
while (AskToPlayAgain());

The while (AskToPlayAgain()); line basically just tells the program to call the AskToPlayAgain function every time it needs a boolean value to resolve whether to do the loop again. I think this is a more elegant solution than the one in the video, but if someone comes across a reason that this is bad practice or against Unreal coding standards or something, please comment!

Privacy & Terms