lightOn = False def setup(): size(800,800) def draw global lightOn if lightOn == True: background(255) else: background(0) def keyPressed(): global lightOn # Option 1: Implementing a True/False toggle lightOn = not lightOn # Option 2: A True/False toggle using an if statement. Same # behavior as Option 1 # if lightOn == True: # lightOn = False # if lightOn == False: # lightOn = True