Text-only
Table of Contents (
frame
/
no frame
)
(12) Logic Control Constructs
Logic Control Constructs
Logic Control
if/elseif/else
switch/case/otherwise
Iterative Loops
for
while
try:
x=34;
y=26;
if x>y
z=1
elseif x==y
z=0
else
z=-1
end
month ='april';
switch month
case{ 'january' 'march' 'may' 'july' 'august' 'october' 'december'}
days=31
case { 'april' 'june' 'september' 'november' }
days =30
case {'february' }
days=28
otherwise
days=-1
end
Logic_Control.src last modified Feb 11, 2014
Introduction
Table of Contents
(
frame
/
no frame
)
Printable
(single file)
© Dartmouth College