C
C#3y ago
._.

Question concerning creating args

I have a question, I am trying to create a new arg in a foreach statement. How can i do this. i also want to call the arg the var that comes from the foreach statement
9 Replies
._.
._.OP3y ago
i cant tell if im stupid and missing an obvious answer
pip
pip3y ago
arg = argument, argument = the values of params sent into a function could you be a little more specific?
._.
._.OP3y ago
so im creating a team arg right and so im doing foreach (int team in teams) { here i want to create a new arg } so it creates a new arg foreach number in teams does that make sense? sorry im bad at explaining'
pip
pip3y ago
i think arg is not the right word i'm not sure what you want to create lol
._.
._.OP3y ago
ok lete me explain so im creating a arg which is has the different teams in it the number of teams can change i want to create a new arg for each of the teams that hold the players or should i just use list but still i dont get how to do either does that make sense?
pip
pip3y ago
class Team
{
public List<Players> players;
}
class Team
{
public List<Players> players;
}
List<Team> teams = new();
foreach(var team in teams)
{
//what do you want to do here
}
List<Team> teams = new();
foreach(var team in teams)
{
//what do you want to do here
}
arg is not the right word
._.
._.OP3y ago
alr thanks
pip
pip3y ago
this is what args are, for future reference: https://www.w3schools.com/cs/cs_method_parameters.php
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
._.
._.OP3y ago
alr thanks
Want results from more Discord servers?
Add your server