Lets say I have a variable name = "Jack"
. I can check it like this
if name:
return name
else:
name = None
return name
Is there any way to handle it in one line like:
new_name = name if not return none
Which simply return the variable value if available and if not then it should return None