Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Writing your own scripts Up: Programming Constructs Previous: for

switch

This is like a multiple if statement.
  sport='tennis';
  switch sport
  case 'soccer' 
    disp('you like soccer')
  case 'tennis'
    disp('you like tennis')
  otherwise
    disp('maybe you like some other sport')
  end



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24