A function is a mechanism for the reuse of a bunch of code.
can use a word to call him. There may be parameter input at the time of the call,
There may be a return value after the call has ended.
Let's just say, Taobao knows.
I'm going to buy a thing from Taobao now. Do I have to give Taobao a directive first. Used to buy something.
Then, Taobao merchants will send things to me. Of course you have to give the money to others first.
This is what I want to buy, this can be considered as a function of the parameters,
What the merchant sends me is the return value of the function.
As for how he works inside, we don't care. He can be thought of as a function code.
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Namespace ConsoleApplication2
{
class program
{
static void Main (string[] args)
{
int i=1;
Print (convert.tostring (Sun (i)));
Console.readkey ();
}
static int Sun (int i)
{
int j = 1;
return i+1 + j;
}
static void Print (string s)
{
Console.WriteLine (s);
}
}
}