Is this bug known? function parameter s and if statements c#
So if you have a function parameter, and there is a if greater then or equals to such as this
 public void yes (float amount) {
     if (amount => 0.5)
     {
     }
 } 
it will give back the error
 error CS0136: A local variable named 'amount' cannot be declared in this scope because it would give a different meaning to 'amount', which is already used in a 'parent or current' scope to denote something else
but take away the = and its sine?
Answer by EvilTak · Mar 02, 2016 at 01:02 PM
That's not a bug, that's a syntactical error on your part.
The => operator is used to define inline anonymous lambdas, which are basically anonymous functions that take one or more parameters and return a value.
So amount => 0.5 is actually
 // The ? is because the compiler can't infer the type of the argument
 delegate(? amount) {
     return 0.5;
 }
Since you've already defined the amount variable before, the compiler can't use the same name for the anonymous function parameter.
I think you meant amount >= 0.5f (You should put the f after every number because Unity works with floats and not doubles).
Remember, the conditional operator ( < or >) always comes before the = in a less/greater than equal to operator ( <= and >=)
Your answer
 
 
             Follow this Question
Related Questions
Component as parameter 1 Answer
Script recieves previous given parameters when instantiating. Why? 1 Answer
Using function return in if statement 2 Answers
Not finding a class in inspector (Easy) 0 Answers
Why doesn't this if-statement work? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                