m1tten
m1tten
CC#
Created by m1tten on 8/20/2023 in #help
❔ Hiya i am new to C# i am having problems with return method
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
int PlayerPositionX = 5;
int PlayerPositionY = 5;
Add(PlayerPositionY, PlayerPositionX);
Console.WriteLine(PlayerPositionX + " " + PlayerPositionY);
//it should be both 10 10 but instead only printing 5 5
}
public static int Add(int X, int Y)
{
X = X + X;
Y = Y + Y;

return X;
return Y;

}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
int PlayerPositionX = 5;
int PlayerPositionY = 5;
Add(PlayerPositionY, PlayerPositionX);
Console.WriteLine(PlayerPositionX + " " + PlayerPositionY);
//it should be both 10 10 but instead only printing 5 5
}
public static int Add(int X, int Y)
{
X = X + X;
Y = Y + Y;

return X;
return Y;

}
thank you so much in advance
37 replies