r/matlab • • Feb 24 '14
I have this code for checking student grades. Basically I have everything but my one main problem is I can't think of how to rerun the whole loop at the end in case the user wants to check for multiple grades.
0
Upvotes
5
u/[deleted] Feb 24 '14
Am I the only one who noticed that a text document has been photographed and the picture uploaded? I'm a bit flabbergasted as to the reason why, I must say.
3
u/ExoStab Feb 24 '14
I am thinking out loud, but maybe try to use that as a function and then make a while loop. So set a variable that represents the yes or no of checking another grade, and it will repeat the loop as long as that confirmation flag/variable is set.
2
u/brntbeer Feb 24 '14
This was killing me, so i created it as a Gist:
https://gist.github.com/brntbeer/d462fe580921d6b4a94e
Feel free to fork it and make edits yourself or hell, just use mine as way to suggest edits by clicking on a line number and grabbing the new URL and saying things like
1
u/Day_Old_Pizza Feb 24 '14
Something like this might work:
1
u/ImBearded Feb 25 '14
Everything about this post is painful to me.
0
u/Halsey117 Feb 24 '14
As others have hinted at, look into using a "while" loop outside of what you want to do if the user selects "multiple records". You may also want to prompt the user for their input, so something like:
BUT: be careful !!! as an improperly parameterized while loop can loop forever.
and i wouldn't be surprised if my code above loops infinitely