Defining double exclamation?

前端 未结 7 1945
失恋的感觉
失恋的感觉 2021-02-04 06:43

I understand what a double exclamation mark does (or I think I understand) but I am not sure how it is defined on a random object. For example in the code snippet below:

7条回答
  •  日久生厌
    2021-02-04 07:06

    bool result = true; 
    result = !!result; // result = true, e.g. !result is false, !!result is !false.
    

提交回复
热议问题