What does "open drain" mean?

Hello Alec,

Good Afternoon.

I am a bit confused with regards to open-collector/ open-drain output pin.

I understand that:-
when the internal transistor is ON, the output would be LOW(0).
when the internal transistor is OFF, the output would be HIGH(1).

But what is my program supposed to write to the port bit ?
To get a LOW(0) output, should I make the bit’s value equal to 0 in the “code” or should I make it’s value 1. I mean, is it like we need to write the complement of the desired output value; 1 to get 0 and 0 to get 1?

Thanks & Regards.