© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
36 replies
m1tten

❔ 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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

I am new to C# (for unity)
C#CC# / help
3y ago
Beginner at C sharp, Having problems with Exponentiation
C#CC# / help
4y ago
I am new to c# and need help
C#CC# / help
3y ago
✅ Having problems with WinUI3
C#CC# / help
3y ago