Function that returns boolean and changes one of its parameters? (117249)

Hi, I’m trying to define a function similar to the function Physics.Raycast(origin: Vector3, direction: Vector3, hitInfo: RaycastHit, distance: float = Mathf.Infinity, layerMask: int = DefaultRaycastLayers): bool;

Where it if it returns true it will also store information into one of its parameters, the “hitInfo” parameter, so how can I define a function that does this?

Thanks!

NOTE: I’m using javascript, I know how to do it in C# but I need in javascript

If you are using C#, you can use the ‘out’ keyword:

http://msdn.microsoft.com/en-us/library/t3c3bfhx.aspx

This should be helpful, provided you’re using C# this is how to use “out” and here are some examples of using conditionals to set out.