# this code I don't understand
def cls(): #if statement freaks me out
os.system('cls' if os.name=='nt' else 'clear')
I understand that it works but not WHY it works. After several hours of perusing google, python docs, and stackoverflow, I am none the wiser. I have been unable to find anything explaining that manner of using an IF statement in a function call like this. I have run it under 2.7 and 3.5 so it does not appear to be specific to a particular version. I have seen similar stuff done with for loops sort of get that it might be a standard way of doing things. I kind of like it myself. Just don't understand how it works.
I am confused about how the IF statement is evaluated within system call and I am especially confused about the syntax of the IF statement. I have not seen that syntax in any of the documentation I have read.
Python is completely new to me. So forgive me if this is bonehead simple. But I don't get it.
os.systemexpects a command, the inlineifgenerates one.systemexpects only a string and the expression delivers it whichever way the if goes.