What does "if 1 ..." means? When is the if condition applied? What does that "1" mean?
Show older comments
So I'm analyzing a code. And there is this if condition : "if 1 ...". I don't understand when this condition is applied? What does the "if 1" mean?
Answers (1)
madhan ravi
on 28 Oct 2018
Edited: madhan ravi
on 28 Oct 2018
0 votes
if 1 means nothing here
Maybe
if a==1
disp('yes')
end
5 Comments
madhan ravi
on 28 Oct 2018
The above explains when a variable a equal to 1 then yes will be displayed because the condition is satisfied.
madhan ravi
on 28 Oct 2018
Povilas Derbutis
on 28 Oct 2018
Image Analyst
on 28 Oct 2018
The programmer just set the condition to 1 to make sure the first block of code gets executed.
Hopefully it was just a temporary thing otherwise the whole if/else is not even needed.
madhan ravi
on 28 Oct 2018
Edited: madhan ravi
on 28 Oct 2018
Thank you sir Image Analyst , as he already mentioned it’s not even needed in this case
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!