Function
1, Concept: is a code block with input parameters, output parameters, return values.
2, the wording:
Modifier return value type function name (input parameter, input parameter)
{
Method segment
return value;
}
3. Comments:
(1) input parameter format: parameter type + variable name. Can not write
(2) return value type---Void is no return value, function body cannot write return
(3) "///" can bring up the comment of the function, which is convenient to view when referencing
(4) need to be under the same namespace as the main function
4. Example:
Public int Jiafa (int A,int b) { return a +b;}
5. Call Method:
Enter a parameter call in the main function
Static void Main (string[] args) { int a , b; 3 ; 5 ; New Class (); // Initialize the class where the function resides first C.jiafa (A, b); // call a function, or you can output }
14. C # Basic finishing (function)