Hey, I tried writing a program to simulate D&D dice. It seemed to work fine until I tried to loop it using (while) and now my code doesn't work. The idea was the program would ask how many roles you were making and with what dice, then it would perform the roles, and after performing the roles it would go back to asking you how many roles, and so on. The program instead created an infinite loop of the same role set, so I commented it out but now it doesn't even display the roles. When you input a dice for it to role it just returns blank and ends the program. Ive been trying for awhile to figure out what happened but I haven't managed to figure it out. Can someone explain why it returns blank now?
'yes' - so is this. Probably. It's bad syntax. ' ' goes around ONE char, but you've put it around three, so what your compiler makes of this I don't know. It really should have told you this was a mistake.
So your condition is:
while ( again == 'y' or TRUE or TRUE )
Always true, so loops forever. Perhaps you meant this:
1 2 3
while ( again == 'y' ||
again == 'Y' ||
again == "yes" ) // note that a char goes inside ' ' , but a string goes inside " "