I am studying for cumulative exam I have tomorrow and I got the following question wrong on a previous exam. I was hoping someone could explain this question to me? What does (~
The ~
means NOT
. However, numeric values are all considered TRUE
unless they are identically equal to 0
.
So, the commands which are actually executed by this logic are:
m = m+1; %Following if (~m)
m = m-1; $Following else
Also, there is a nested if
statement in the code. It will be easier to read if you used multiple level indentations.