Assets\Gun.cs(24,24): error CS1002: ; expected

I have this error I don’t know how to fix it here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Gun : MonoBehaviour{
public float range = 100f;

public float damage = 10f;

public Camera fpsCam;

void Update()

    if (Input.GetButtonDown("Fire1")){
void shoot();
string  RaycastHit hit;

if ( physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hitrange))





Learning how to read error messages is just as important as learning to code.

The text “Assets\Gun.cs(24,24)” tells you the script, the line and the position within the line where C# found an error.

CS1002 is the error code and is followed by the description. You can easily find the C# error codes online, just search for CS1002. In this case, you are told that you are missing a semicolon (the text says “; expected”)

Putting these together means that you have forgotten a semicolon at the end of a line. In this case, it’s the shoot() instruction in your update loop.

this code is for c#