201504 C#初級班-function

201504 C#初級班-funtion 程式一
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static public int function()//可以改變數名稱 不可用整數 可用別的英文代替
        {

            return 5;
        }
        static void Main(string[] args) //static靜態 void 不回傳值 Main 進入點
        {
            Console.WriteLine("a:" + function().ToString() );
            Console.ReadKey();
        }


    }
}
程式二
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static public int function(int x)
        {

            return x;
        }
        static void Main(string[] args) //static靜態 void 不回傳值 Main 進入點
        {
            Console.WriteLine("a:" + function(20).ToString());
            Console.ReadKey();
        }


    }
}

Comments

Popular posts from this blog

MEGA 暫存檔案刪除

IOS GCD多執行緒

利用CMD指令強制刪除