I am writing the code for rock, paper, and scissors.
I want to ask users' input, if it's rock, paper, or scissors, I want to store the value to user_choice
if the input is anything else, it will just display an error message.
my code is below, does not matter what I put in for the input, it always go through both if and else section, can anyone explain or help to fix it please?
prompt = 'rock(r),paper(p),or scissors(s)? Make a choice!';
user_choice = input(prompt,'s')
if user_choice == 'r'|user_choice =='p'|user_choice =='s'
fprintf('Your choice is %s/', user_choice);
display('Please select among r, p, or s');