I have been reading learning c# by programming games in unity and am pleased with the book so far however I have found various segments that are confusing to me…
List<string> ponyList = new List<string>() {"Princess Cadence", "Fluttershy"}; foreach(string pony in ponyList){ if (pony=="Fluttershy"){ Debug.Log ("done") } }
Can u please tell me the purpose of “in” and any reference links…
the foreach Loop runs through your list ponyList once per item in the list (2 times in your case). in each run Pony equals the item of the current list object so in your case it would be “Princess Cadence” in the first run and “Fluttershy” in the second run.