Here is an example while loop for a basic Yahtzee game in Matlab:
main.m1109 chars41 lines
In this example, the while loop will continue until the player chooses to end the game by entering 'n' when prompted. The loop includes logic for rolling the dice, allowing the player to reroll up to 2 times, calculating the score, and repeating the game as desired.
gistlibby LogSnag