OK, I'm just playing with some code. Here's the code:
clear, clc;while 1n = input('Type a Word Starting With a Capital Letter: ','s');n=n(1);switch n case 'A' disp('An A word!') break; case 'B' disp('A B word!') break; case 'C' disp('A C word!') break; case 'D' <= 'Z' disp("try using A,B or C this time") otherwise disp('incorrect word, I said use a CAPITAL!')endend
I added the "while true" to keep the program running until one of my cases is met. I'm trying to use a range from "D" to "Z" but it doesn't seem to work. I thought the characters were seen as an integer in programming so I'm not sure why it can't evaluate the case?
Best Answer