After the if statement is ran why is the answer 10?
1 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
Voss
2022-7-30
A=1;
B=2;
C=10;
if A<0 % false (1 is not less than 0)
% ... nothing in here executes
end
disp(C) % C remains 10
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!