Another Javascript to C# convert

Well i was converting big javascript code to C#. Everything’s done, but only this one is left:

static void ClampAngle (float angle, float min, float max) { 
	if (angle < -360) 
		angle += 360; 
	if (angle > 360) 
		angle -= 360; 
	return Mathf.Clamp (angle, min, max); 
// Update is called once per frame

Error says: Since “DoesntMatterScriptName.ClampAngle(float, float, float)” returns void, a return keyword must not be followed by an object expression

You cannot provide a return statement in a function that does not have a return type.


Is a return type, a return type of nothing.

float ClampAngle(float angle, float min, float max)

Now your function has a return type of float.