Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What does the fact function in VB mean? I just came into contact with VB, and the concept of grasping feet is too abstract. The functions we usually contact are all with expressions. this
What does the fact function in VB mean? I just came into contact with VB, and the concept of grasping feet is too abstract. The functions we usually contact are all with expressions. this
1, the function can be understood as an algorithm, which is designed to solve a certain problem, and is also suitable for VB without the limitation of language.

Functions usually have input and output, just like a factory, which sends in raw materials, processes them and sends out finished products.

For example, the following custom functions:

Returns factorial with a long integer as a parameter?

Private? Function? Fact (ByVal? part 1? As? Dragon) As? Dragon?

The truth? =? 1

What time? Part 1

The truth? =? The truth? *? Part 1

part 1? =? part 1? -? 1

line

End? The function calls this function: Print Fact(4), and the factorial result of 4 will be printed.

In this function, the formal parameter part 1 is the data to be processed, and the returned result is the processed data, that is, factorial-the function of this function.

VB library functions are the same as API functions, both of which encapsulate the code with a certain function for easy calling. We don't have to pay attention to its internal implementation, we just need to understand the interface.

2. As for parameters, they are not necessary for functions. For example:

Private? Function? Fac()

Me. Print? "output? Answer? String! "

Me. Print? "Do what? That? Best! "

End? function

Private? Sub? Form _ Click ()

Fac's calling function?

End? Sub this function is used to output specific content without parameters.

Function is a relatively basic thing, and learning it well is helpful to improve programming ability.