can a white space be included in a switch statement?
Show older comments
good day! may I ask, can a ' ' or space be included in the switch statement.
For example
switch(var)
case 'Hello World'
end
is it possible? I really need to have two words for matching the expression var. thanks!
Answers (1)
Azzi Abdelmalek
on 23 Feb 2013
Edited: Azzi Abdelmalek
on 23 Feb 2013
Yes you can
a=' '
switch a
case ' '
d=10
case '1 2'
d=1000
end
Categories
Find more on Get Started with MATLAB 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!