%Origami fortune teller
clc; clear;color = input('Enter (R)ed, (G)reen, (B)lue or (Y)ellow: ', 's');if color == 'R' || color == 'G' || color == 'B' || color == 'Y' %proceed
if color == 'R' || color == 'B' num = input('Coose 1, 2, 5 or 6: '); if num == 1 fprintf('Fortune 1 \n'); elseif num == 2 %fortune 2
elseif num ==5 %fortune 5
elseif num == 6 %fortune 6
else fprintf('Invalid inpuit! \n') end else num = input('Choose 3, 4, 7 and 8: '); if num == 3 elseif num == 4 elseif num == 7 elseif num == 8 else fprintf('Invalid Input! \n'); end endelse fprintf('Invalid input! \n');end
This is an example code to demonstrate if/else statements and nested if/else statements, but I'm confused about what the 's' denotes in the color input. I'm attempting to complete a similar code, but it won't function with or without the 's' and I'm wondering if I'm doing something else incorrectly or if I'm misinterpreting this notation.
Best Answer