Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does mean the command if(0) in r?

Tags:

r

I have a question, I have been reviewing some code and in one script, the authors use:

if(0){
    #do something
}

Any help in what if(0) means?

like image 273
user2380782 Avatar asked Sep 20 '15 21:09

user2380782


1 Answers

The author (most likely) put the block of code in an if statement so that they could easily remove it if necessary without having to comment it out (or remove it). Similar to if(true) or if(false), you just need to change one value and it would skip that code.

Upon reviewing the code, developers should remove these kinds of statements once they've finalized all their source code not to confuse others.

like image 99
ergonaut Avatar answered Sep 20 '22 14:09

ergonaut