21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Scope and Life Span of Variables 23<br />

Sub Test<br />

SetModuleA ' Sets the variable C from module A<br />

SetModuleB ' Sets the variable C from module B<br />

ShowVarA ' Shows the variable C from module A (= 10)<br />

ShowVarB ' Shows the variable C from module B (= 20)<br />

End Sub<br />

Sub SetmoduleeA<br />

C = 10<br />

End Sub<br />

Sub ShowVarA<br />

MsgBox C ' Shows the variable C from module A.<br />

End Sub<br />

Module B:<br />

Private C As Integer<br />

Sub SetModuleB<br />

C = 20<br />

End Sub<br />

Sub ShowVarB<br />

MsgBox C ' Shows the variable C from module B.<br />

End Sub<br />

Source: http:/ / <strong>wiki</strong>. services. openoffice. <strong>org</strong>/ w/ index. php? title=Documentation/ <strong>BASIC</strong>_<br />

<strong>Guide</strong>/ Scope_ of_ Variables&oldid=104493<br />

Principal Authors: Fpe, Ccornell, TJFrazier<br />

Constants<br />

Constants are values which may be used but not changed by the program.<br />

Defining Constants<br />

In <strong>OpenOffice</strong>.<strong>org</strong> Basic, use the keyword Const to declare a constant.<br />

Const A = 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!