The usage of Block variables makes your program clear and clear !, Block Variable
- <Span style = "font-size: 24px;"> Why use block variables?
- Because when our programs are complicated, we need to call a function in a function and define it outside, which is inconvenient to implement, however, with block variables, we can define a block variable within a function, which is equivalent to defining a function within the function.
- Int (^ max) (int x, int y) = ^ (int x, int y) // calculates the maximum value of two numbers.
- {
- Return x> y? X: y;
- };
- NSLog (@ "% d", max (5, 10 ));
- Int (^ min) (int x, int y) = ^ (int x, int y) // calculates the minimum value of two numbers.
- {
- Return x> y? Y: x;
- };
- NSLog (@ "% d", min (5, 10); </span>
[Cpp]View plaincopy
- <Pre name = "code" class = "cpp"> <span style = "font-size: 24px;"> The block Variable type is int (^) (int x, int y );
- Max is the variable name. It generally depends on the function type. You only need to remove the function name and the rest is the function type.
- ^ (Int x, int y)
- {
- Return x + y;
- }
- The block variable is initialized above. </span>
[Cpp]View plaincopy
- <Span style = "font-size: 24px;"> If a local variable defined externally by the block is used inside the block, if the variable is not modified by _ block, the block is read-only and cannot be modified. to modify the block, _ block must be added before the variable.
- _ Block tells the compiler not to use external variables as constants or variables in the block during compilation.
- If you access global variables in the block, you do not need to modify the _ block,
The error message "91 object variables not set or with block variables" is displayed when the chemical gold medal is running. The word version I use is WPS.
It is best to apply the chemical gold to word2003, which is not suitable for wps currently.
Program running error written in VB: ActiveX cannot create objects. runtime error: "91" no object variable or with block variable is set
To reference objects, third-party applications that come with the system in components must be registered first.