NJ21286
NJ21286

Reputation: 11

Python:- what is meaning of "if(true)"

I am trying to debug current code and I am new in python, Need to understand below code Why they use this code and Whats use of this code in python

def _init_():
  if(true):

Upvotes: 1

Views: 650

Answers (1)

Xufeng
Xufeng

Reputation: 6762

Before figuring out what if(True) does, think of if(False) first. if(False) is actually a commonly used idiom which has the same effect as commenting out multiple lines - all the code that's in its indentation block will not be executed since the condition is always evaluated as false. Later, if you want those lines of code below if(False) to be executed again, you can simply change False to True - that's how if(True) comes in. Itself doesn't do anything, it is its opposite if(False) that is useful.

Upvotes: 2

Related Questions