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