Control Structures

The if decision structure

if x > 0
    disp(' x is positive')
elseif x = 0
    disp('x is zero')
else
    disp('x is negative')
end
A simple for loop
for i = 1:10
        i
end


A simple while loop

while x > 0
   x^2
   x = x - 1;
end