can a white space be included in a switch statement?

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)

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

Asked:

on 23 Feb 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!