END(块)
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgEndblock
- 最后更新: 2016-03-12
标识复合语句块的结束。
语法
End { Sub | Function | If | Select | Type | Enum | Scope | With | Namespace | Extern | Constructor | Destructor | Operator | Property }说明
用于标识最近一个代码块的结束。
命令中必须包含块的类型,可以是以下之一:Sub、Function、If、Select、Type、Enum、Scope、With、Namespace、Extern、Constructor、Destructor、Operator 或 Property。
结束 Sub、Function、If、Select、Scope、Constructor、Destructor、Operator 或 Property 块时,同时会关闭该块内定义的变量的作用域。作用域关闭时,块内定义的变量将被销毁,并根据需要调用其析构函数。
要结束程序,请参阅 End (Statement)。
示例
start GeSHi
vb
Declare Sub checkvalue( n As Integer )
Dim variable As Integer
Input "Give me a number: ", variable
If variable = 1 Then
Print "You gave me a 1"
Else
Print "You gave me a big number!"
End If
checkvalue(variable)
Sub checkvalue( n As Integer )
Print "Value is: " & n
End Subend GeSHi
与 QB 的区别
- 无
另请参阅
ConstructorDestructorEnd (Statement)EnumExternFunctionIf...ThenNamespaceOperatorPropertyScopeSelect CaseSubTypeWith
返回 目录