Can anyone explain this statment in this code ?

so i have been follwing this unity tutorial on youtube and the youtuber made a line that he didn"t explain cos he said it’s too complicated and we don’t have to understand well I do want to understand that line cos this is the right way to learn I did google the line and it’s function and found them on unity manuels yet I didn’t undrstand that much so could any one explain to me what this line do ?
b.

b.onClick.Addlistener.(()=>oncolorselect(currentindex));

So i want to understand the Addlistener part and that" =>" part isn’t supposed to mean superior or equal to ?
currentindex is float btw

2 Likes

Specifically:

=> is the Lambda operator

Definitely worth learning about :slight_smile:

1 Like

“Greater than or equal to” is >=
Lambda operator is =>

i.e. it’s more like an arrow.

The links provided above are excellent and I’d recommend reading them.

The tl;dr version is it’s an anonymous function that you can create on the fly. As you get more experienced with C#, you’ll find yourself using them a LOT, so they’re well worth reading about and fully understood.