Difference between revisions of "JA/Documentation/BASIC Guide/Constants"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
Line 29: Line 29:
 
Public Const one As Integer = 1
 
Public Const one As Integer = 1
 
</source>
 
</source>
 +
  
 
{{PDL1}}
 
{{PDL1}}
{{InterWiki_Languages_BasicGuide|articletitle=Documentation/BASIC Guide/Constants}}
 
 
{{InterWiki_Languages_BasicGuide|articletitle=Documentation/BASIC Guide/Constants}}
 
{{InterWiki_Languages_BasicGuide|articletitle=Documentation/BASIC Guide/Constants}}

Latest revision as of 16:47, 15 December 2008

doc OOo
Book.png

定数とはプログラムで使用できますが、変更できない値です。

定数の定義

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).
Personal tools