Saturday, April 26, 2025

C# - Return Value from Method

using System;

namespace LearnCS
{
    class Program
    {

        static int GetStuff() {
            int x = 10;
            int y = 20;
            int z = (x + y);

            return z;
        }

        static int MultipBy2() {
            int multiplied = (GetStuff() * 2);

            return multiplied;

        }

        static void Main(string[] args)
        {

            //Console.WriteLine(GetStuff());

            Console.WriteLine("Result from MultipBy2 Method: " + MultipBy2());
        }        
    }
}

 

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...