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

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

  •  10-07-2023
  •  | 
  •  

Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top