After the if statement is ran why is the answer 10?
Mostra commenti meno recenti
A=1;
B=2;
C=10;
if A<0
C=5;
if B==2
C=3; %I thought the answer would be 3 why is it 10?
end
end
disp(C)
Risposta accettata
Più risposte (1)
James Tursa
il 30 Lug 2022
A=1;
:
if A<0
A is not negative, so the body of the if-test never runs.
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!