Simply inverting a pin?
digitalWrite (43, ! digitalRead (43)) ;
Though one would normally store the pin state in a variable:
pin_state = !pin_state ; // invert
digitalWrite (43, pin_state) ; // output
If you call digitalRead it takes more time and you are sensitive to the pin being shorted out
causing different behaviour.