After the if statement is ran why is the answer 10?

 Risposta accettata

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
10

2 Commenti

Ohh okay that makes sense thank you very much
You're welcome!

Accedi per commentare.

Più risposte (1)

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

Richiesto:

il 30 Lug 2022

Commentato:

il 31 Lug 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by