I'm trying to create an input form that takes two different answers. And when you type a wrong answer, I want it to go back to the input and start over.
My code is (the original text was in danish, so i put a bad english example in the forms):
value = input('Write hi or goodbye','s'); if isequal(value, 'hi') fprintf('Hello\n'); elseif isequal(value, 'goodbye') fprintf('see you\n'); else fprintf('wrong answer try again!\n'); end
So what can i do about the else statement? I was thinking about some message saying: The answer is incorrect, will you try again? (y/n)
Thanks in advance!