I dont understand how this works

string[] friends = { "Zuka", "Jajo", "Bedo", "Quji", "Rhaast" }; Console.WriteLine(" "); foreach (string s in friends) { Console.WriteLine("Hello " + s); } so why does the string s transform into the friends I understood for how it worked with ints but I dont get it for strings
3 Replies
Angius
Angius12mo ago
The loop gets each string from the friends array And saves it in variable s So with first iteration, s is "Zuka". With the second iteration, s is "Jajo", and so on
ふぶき 知ろう
ふぶき 知ろうOP12mo ago
ohhh so every variable in the friends array is = to s okay ty very much for the help and calirification
Angius
Angius12mo ago
Anytime
Want results from more Discord servers?
Add your server