if else conditional statement

some notes

% conditional statement if else
clear;clc;
a = rand;
if a < 0.5
    b=-1;
else 
    b = 1;
end

% if a is 0.2512, b value is -1

if-elseif-else conditional statement

clear;clc;
 a=rand;
if a<0.3
    b = -1;
elseif a>0.3 & a<0.7
    b=0;
else 
    b =1;
end

results matching ""

    No results matching ""