What does the ^ operator do to a BOOL?

后端 未结 7 1702
情深已故
情深已故 2021-01-23 04:10

What does this statement mean?

isChecked = isChecked ^ 1;

isChecked is a BOOL.

7条回答
  •  无人及你
    2021-01-23 04:51

    ^ is the exclusive or operator.

    In your example it is used to create a toggle - isChecked will be set only if isChecked was previously unset.

提交回复
热议问题