常量
From Apache OpenOffice Wiki
< ZH/Documentation/BASIC Guide
Revision as of 22:06, 12 December 2008 by G11nAutomation (talk | contribs)
常量是程序可以使用但不能更改的值。
定义常量
在 Apache OpenOffice Basic 中,使用关键字 Const 来声明常量。
Const A = 10
还可以在声明中指定常量类型:
Const B As Double = 10
常量的作用域
常量具有与变量相同的作用域(请参见变量的作用域和生命周期),但语法略有不同。模块标头中的 Const 定义可以在该模块的代码中使用。要使该定义可用于其他模块,请添加 Public 关键字。
Public Const one As Integer = 1
Content on this page is licensed under the Public Documentation License (PDL). |