Operator '||' cannot be applied to operands of type 'bool' and 'lambda expression'

StackOverflow https://stackoverflow.com/questions/23331047

  •  10-07-2023
  •  | 
  •  

문제

I'm getting this error Operator '||' cannot be applied to operands type 'bool' and 'lambda expression' I'm struggling with this

if ((counter <= value1) || (counter => value2))
{
// Do something
}

Can you please help me out.

도움이 되었습니까?

해결책

It’s >= (said “greater than or equal to” after all), not =>. => creates a lambda expression – in this case, one that takes an argument called counter and always returns value2.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top