% sample: switch clear;clc; idxc = 0 ; while idxc < 1 var1 = input('Do you want to learn matlb? Y/N \n','s'); % ???? switch var1 case 'Y' display('Matlab loves you.') idxc = 1; case 'N' display('You have no choice.') otherwise display('You are baffling.') end end