Different behaviour of code in javascript C#script

i can’t use the below mentioned type of

overloaded method of

UnityEngine.Physics.Raycast in C# script

but can use in Javascript.

Physics.Raycast(transform.position,

transform.forward,hit, 100.0);

i am using these classes in my file in c#

script

using UnityEngine;
using System.Collections;

return type of transform.position is

vector

return type of transform.forward is

vector

return type of hit is RaycastHit

error msgs is as follow

The best overloaded method match for

`UnityEngine.Physics.Raycast(UnityEngine.

Vector3, UnityEngine.Vector3, float)’ has

some invalid arguments

Argument 4: Cannot convert type

UnityEngine.RaycastHit' to int’

plz solve my query
thanks

try

Physics.Raycast(transform.position,

transform.forward, out hit, 100.0);

In c# you must use keyword “out” to pass the argument by reference. Similar to the “ref” keyword, but that requires the variabel to initialized before being passed.