Question by
Rastaxelou · Jan 21, 2017 at 01:51 PM ·
arrayfunctionparameters
Put array in function 'parameters ?
Hello ! Sorry for my English, I hope you understand this.
I try tu put string array, in parameter of one function. I try this :
public void test1 (string[] array, string answer){
foreach (string word in array) {
if (tempTextPlayer.Contains (word) {
StartCoroutine(SayIA(answer));
}
}
}
I hope you can help me, thanks !
Comment
Best Answer
Answer by Pengocat · Jan 21, 2017 at 02:55 PM
Perhaps you are just missing another parenthesis after this in line 5 if (tempTextPlayer.Contains (word)
public void test1(string[] array, string answer)
{
foreach (string word in array)
{
if (tempTextPlayer.Contains(word))
{
StartCoroutine(SayIA(answer));
}
}
}
Your answer
Follow this Question
Related Questions
After picking a random object from an array, how to run the functions only for the chosen object? 0 Answers
Need a function to loop through an array to check tags 1 Answer
Function overloading with and optional arguments 1 Answer
Storing functions to use later 0 Answers
Cannot convert 'String' to 'Array'. 2 Answers