Calling on a function in an if statment?

I’m trying to call upon a function in an if statment, like

if(NameOfFunction() == true{
         Execute code here;
}

But not entirely sure how to do it… Any help?

EDIT: Here’s the code incase it helps, It’s probably messy and there’s most likley much better ways of doing what i’m trying to do,But i’m learning and this is all of my own back which i’m somewhat proud of… Even though it doesn’t look like much

#pragma strict

static var haveFlashlight : boolean = false;
var Flashlight : GameObject;
var FindAudio : AudioClip;
var flashlightEmitter : Light;
var Footstep_Concrete : AudioClip;
var isMoving : boolean = false;

function Start () {
	Screen.showCursor = false;
}

function Update(){
	
	if(haveFlashlight == true  Input.GetKeyDown("f")){
		flashlightEmitter.enabled = !flashlightEmitter.enabled;
	}
	
	if(haveFlashlight == true){
		Debug.Log("haveFlashLight = True");
			audio.clip = FindAudio;
				audio.Play();
					audio.clip = Footstep_Concrete;
			
	}
	if(IsMoving() == true){
	audio.clip = Footstep_Concrete;
			if(!audio.isPlaying)
				audio.Play();					
					Debug.Log("Moving");
			}
			
	
	
	
	}	


function IsMoving(){
	
	if(Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D)){
		isMoving = true;

	}
	else if(!Input.GetKey(KeyCode.W) || !Input.GetKey(KeyCode.A) || !Input.GetKey(KeyCode.S) || !Input.GetKey(KeyCode.D)){
		isMoving = false;
	}
}

IsMoving should return a value if you want to use it in if statement. But you dont need to use IsMoving() just use the variable you declared isMoving.

Also, since isMoving is a boolean only if( isMoving ) is enough.

Yeah… jsut realised, I’m having an issue playing an amimation now, it’s a Headbob animation, and i can look left / right while the animation is playing, but unable to look up / down?, The animation is directly on the Main Camera of the First Person Controller, any idea what the issue could be?

EDIT:, I think it’s becasue it’s the ‘body’ that rotates around the Y axis, and the Camera that rotates along the X axis, so the Y axis isn’t affecting the Animation because the parent (Body) is the thing that’s moving, Any ideas how to get around that?