My class is “s2” so I’m sending myint to that class function, so that’s not problem, but what if I want to return a variable? For example, let’s say I am sending a “score” variable and I want another classes function to change the score then send it back to the original function.
I’m coming from Adobe Director where I Can just set a global variable and be done with it, but this is clearly a little more taxing!
When ur setting void as the return type of the function, you’re specifying that the function doesn’t return a value. If you want it to return an int, give it a return type of int.
public int DoSomething (int score)
{
//do fancy things with score
return score;
}