简体   繁体   中英

"Identifier expected" error—can not find the source

I'm stuck with this "Identifier expected" error and I can not find what I'm missing. Code below produces the error. If I comment out the method I'm defining, the error goes away. Seems like it should be a simple syntax issue from other posts, but I can not find what I've done wrong.

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

public class statsMagic : MonoBehaviour
{
    public int value;
    public List<int> mixingTable = new List<int>();
    
    public void addValue(value)
    {
        mixingTable.Add(value);
    }

}

I really appreciate if anyone can see what I'm missing.

You must specify the type of the parameter that is required by your addValue method:

public void addValue(int value) // note the int
{
    mixingTable.Add(value);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM