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

From Apache OpenOffice Wiki
Jump to: navigation, search
(New page: {{DISPLAYTITLE:定数}} {{JA/Documentation/BASICGuideTOC/v2 |ShowPrevNext=block |ShowPrevPage=block |PrevPage=Documentation/BASIC Guide/Scope of Variables |NextPage=Documentation/BASIC Gui...)
 
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
|ShowPrevNext=block
 
|ShowPrevNext=block
 
|ShowPrevPage=block
 
|ShowPrevPage=block
|PrevPage=Documentation/BASIC Guide/Scope of Variables
+
|PrevPage=JA/Documentation/BASIC Guide/Scope of Variables
|NextPage=Documentation/BASIC Guide/Operators
+
|NextPage=JA/Documentation/BASIC Guide/Operators
 
|lang=block
 
|lang=block
 
}}
 
}}
Line 24: Line 24:
 
==定数の範囲==
 
==定数の範囲==
  
定数の範囲は変数と同じです ([[Documentation/BASIC Guide/Scope of Variables|「変数の有効範囲と寿命」]]参照)。ただし、構文が若干異なります。モジュールヘッダの <tt>Const</tt> 定義は、そのモジュールのコードに対して使用できます。定義を他のモジュールでも使用可能にするには、キーワード <tt>Public</tt> を追加します。
+
定数の範囲は変数と同じです ([[JA/Documentation/BASIC Guide/Scope of Variables|変数の有効範囲と寿命]]」参照)。ただし、構文が若干異なります。モジュールヘッダの <tt>Const</tt> 定義は、そのモジュールのコードに対して使用できます。定義を他のモジュールでも使用可能にするには、キーワード <tt>Public</tt> を追加します。
  
 
<source lang="oobas">
 
<source lang="oobas">
 
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}}

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