Second T language instance development, lottery 3D

Source: Internet
Author: User

---restore content starts---

The meaning and use of the prior knowledge function of lottery 3D device

function is the basic module of TC source program, which realizes the function of function module, the function of TC language is equivalent to the subroutine of other high-level language.

Inside the TC, the function is divided into three parts:

TC Library function: This kind of function is TC built-in, can call arbitrarily

TC Event Function: This type of feature is an event of an interface control.

TC customization: This type of value is customized according to the functionality of the code, with greater flexibility and usability.

Use of custom Features

Format: function + space-function name + ()

End of function

Parameter description of the function

In the TC function is divided into two categories: no parameter function, has the function of the parameter.

1. No parameter function

No parameter: the test () function has no parameters, so it is not necessary to pass in the value when it is called.

For example:

2, parameter function, but no default value and reference parameters

Function: the test () function has 2 parameters, so when you call the test function, you need to pass in 2 parameters.

For example:

In TC, when defining a function, we can also add the default value to the parameter, that is: if the function is invoked, the function will use the default action, if the parameter is passed in, then the function will not use the default value.

Note: The default value parameter cannot be in the middle of the parameter, and if it appears in the middle, all subsequent arguments must have a default value, or a syntax error will occur.

Return statement of the function

The return statement of the TC is the same as the return statement for the other high-level languages, representing the return value of the feature, such as:

and = SUM (10,5)

The return statement is not required in the function and can not be written. Do not write a return statement, it means that the function has no return value.

When do I need a return value?

End the execution of the current function in the program and pass the required data to the required variables;

Instance interface:

code example:

Function button Exit _ Click ()    //Add the code you want to execute    exit () endfunction ()    var number = "    var len    var six-bit, five-bit, four-bit, three-bit, two-bit, one    len = editgettext ("edit box Count") for    (var i = 0; i < len; i++)        Six bit = Rnd (0,9)        Five bit = rnd (0,9)        Four bit = rnd (0,9) c10/> three-bit = Rnd (0,9)        two-bit = rnd (0,9)        One bit = Rnd (0,9)        number = number & "& Six-bit &" "& Five-bit &" & ; Four-bit & "& three-bit &" "& Two-bit &" "& One &" \ r \ n "        end    return number endfunction button Machine Select _ Click () 
   
    //here to add the code you want to execute var the result of the number    of results = number ()    editsettext ("edit box Number", the result of the wave)    end
   

  

  

Second T language instance development, lottery 3D

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.