Why does my variable become NULL?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JoeSeki

My code is
r = MaR.rRLFastIn
print (f)
f = FacingL()
print (f)

the output is

0
Null

FacingL() is
func FacingL():
if (Facing == Enums.RobotFacing.NORTH):
Facing = Enums.RobotFacing.WEST
elif (Facing == Enums.RobotFacing.WEST):
Facing = Enums.RobotFacing.SOUTH
elif (Facing == Enums.RobotFacing.SOUTH):
Facing = Enums.RobotFacing.EAST
elif (Facing == Enums.RobotFacing.EAST):
Facing = Enums.RobotFacing.NORTH
else:
LogE (“Robot.FacingL: Facing is messed up”)

How does my variable become NULL?

:bust_in_silhouette: Reply From: exuin

f is being assigned to the return value of FacingL(), but the function doesn’t have a return value, so null is assigned to f.

OMG! such a simple mistake to make! Makes me wonder why it was working in most places but stopped there! Thank you!

JoeSeki | 2021-02-15 21:45