It's about parameter in fuction

I saw an example of using parameters in cospaces. But I do not understand it yet, so I ask you a question.
Please give details about 1 and 2.

What I understand is that I created a function called ‘bindwallbehaviour’ to apply to the wall, and I understood that it was an item to meet this wall.

What I really want to understand is the meaning of ‘wall’ in ‘bindwallbehaviour with: wall’ in your function and the meaning of ‘item’ in this function block.

I am trying to understand for a few days because I am not good at coding. The most difficult thing is understanding the function. Your kind explanation would be a great gift to me

Thank you very much:تفكير:

Hi Jeongmin!

To (1)
Item represents a single item in the list called “block”. What happens here is for every Cuboid that is in the “block” list, we perform the bindWallBehaviour function on that item. Similar to the for each loop that is written above (1), which sets the opacity of every item in the “block” - list to 0.1, we call the function bindWallBehaviour with every item in the “block” - list.

To (2)
In this example, we call the bindWallBehaviour function within itself, and pass the same wall-item as parameter. This causes bindWallBehaviour to bind a new onHover and onActivate handler to the wall-item again.

Here’s another example on using functions with parameters:
image

This doSomething function accepts a someItem parameter. If you now call this function and use a Cuboid as parameter, the someItem parameter will be the cuboid.

image

Click to see example in action

Hi

The cool thing about functions is that you can re-use them! You can use the logic stored in this function with any other item. For example, we make another item and pass it as parameter for our doSomething function
image

Click to see example in action

Hi2

Functions are very handy to make re-usable code. I hope this example helped!