How to get different input, depending on the last input
Show older comments
So I need to make a chatbot script and i'm stuck on this part
x = input('+ ', 's');
s={'hey','hi','hello'};
if ismember(x,s)
disp('Hello, What''s your name?')
else disp('Don''t you say hello?')
end
So at this point if the user inputs hello I can ask for the next input which is the name. But if they don't, it displays the else situation. How do I go a different direction if the user doesn't say 'hello'? So for example, after displaying the else, if the user inputs 'hello' the script would return 'That is better, hello back' or something.
Sorry if i'm unclear, thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!