Is `if (condition = value)` the correct syntax for comparison?

前端 未结 5 1413
轮回少年
轮回少年 2020-12-12 00:30

If if((hit.transform != transform) means if hit.transform is Not transform, then how do I check if the statement Is correct. if(hit.transfor

5条回答
  •  無奈伤痛
    2020-12-12 01:04

    • != is not equal to.
    • == is equal to.

    So you'd write:

    if (hit.transform == transform) {
    

    What you wrote actually attempts so set the value of hit.transform to transform.

提交回复
热议问题