error CS1519: Invalid token 'void' in class, struct, or interface

hello

i just start learning and i stuck with this error. it suposed to be a struct that has name, damage and method that should say about himself.

Code (CSharp):

  • using System.Collections;
  • using System.Collections.Generic; xvideos
  • using UnityEngine;
      • public struct Weapon
  • {
  • public string name;
  • public int damage;
  • public Weapon(string name, int damage)
  • {
  • this.name = name;
  • this.damage = damage;
  • }
  • pubic void PrintWeaponStats()
  • {
  • Debug.LogFormat(“Weapon {0} - {1} dmg”, name, damage);
  • }
  • }

hope for your help, thanks!

There is a typo in your code. The word “public” in the method PrintWeaponStats() is misspelled as “pubic”. :roll_eyes: