Dark Horse programmer _ function parameters

Source: Internet
Author: User

1. Parameter Array

Define code: Similar to a common function, a keyword params is added at the end of the parameter list.

Call Code: <Function Name> (<several parameters...>, <Parameter array value 1>, <parameter array value 2>, <parameter array value 3>... <Parameter array value n> );

Sample Code: // Defines a code with a parameter array. The function is to pass in the value in the parameter array and return the maximum value;

){

); // Call a function that contains an array of parameters.

 

 

2. Reference parameters and value Parameters

 

 

Definition code:Keyword ref is required for defining values.

Call code:In order to distinguish between calls of value-type parameters, we also need to use the ref keyword when passing variables into a function containing referenced parameters to demonstrate the difference;

){

 

);

Limitations of referenced parameters:Nothing can be perfect. The referenced parameters are also limited. It is actually a small rule of normal syntax.

 

 

3. Output Parameters

){

 

);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.