I have a script that checks if a word is in my array called dictionary when a user presses a submit button. My script works fine so far but the only error is in this chunk:
public bool Check (string){
for(int i =0;i<=dictionary.length;i++){
if (word==dictionary[i]){
return true;
}
else{
return false;
}
}
}
This method is called when the user presses submit. The error says identifier expected. Any suggestions? I feel like this is going to be a really obvious answer and I am going to feel really stupid 
People seem to avoid my threads…
This:
public bool Check (string)
should be:
public bool Check (string word)
Jeff
That’s actually not what your script does; rather it only checks the first entry in the dictionary array and ignores the rest. In any case you don’t need to write your own function for that:
if (System.Array.IndexOf(dictionary, word) != -1) {
Debug.Log(word + " exists in the dictionary");
}
–Eric
Ah OK thank you Eric but i have one more problem. I changed it to public bool Check(word string){… but now mono says “default parameter specifiers are not permitted” and “invalid expression term string.” I don’t understand this. I have one method call Check(txtinput); shouldn’t my method Check(string word) receive txtinput?
Never mind i figured it out. Thank you jgodfrey and eric!