summaryrefslogtreecommitdiff
path: root/helpcontent2/source/text/sbasic/shared/01010210.xhp
diff options
context:
space:
mode:
authorFrank Peters <fpe@openoffice.org>2004-08-18 09:59:46 +0000
committerFrank Peters <fpe@openoffice.org>2004-08-18 09:59:46 +0000
commit4f48bcc7937fbc586af7720d4225768ee6913e2a (patch)
tree431c32101c9b8349fe8f420615df796296d69a90 /helpcontent2/source/text/sbasic/shared/01010210.xhp
#i33146# Initial checkin
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/01010210.xhp')
-rwxr-xr-xhelpcontent2/source/text/sbasic/shared/01010210.xhp87
1 files changed, 87 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/01010210.xhp b/helpcontent2/source/text/sbasic/shared/01010210.xhp
new file mode 100755
index 0000000000..b56dda8e8a
--- /dev/null
+++ b/helpcontent2/source/text/sbasic/shared/01010210.xhp
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************--><helpdocument version="1.0">
+<meta>
+<topic id="textsbasicshared01010210xml" indexer="include" status="PUBLISH">
+<title xml-lang="en-US" id="tit">Basics</title>
+<filename>/text/sbasic/shared/01010210.xhp</filename>
+</topic>
+<history>
+<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
+<lastedited date="2003-10-31T00:00:00">converted from old format - fpe</lastedited>
+</history>
+</meta>
+<body>
+
+
+ <section id="modular">
+ <paragraph id="hd_id3154927" role="heading" level="1" oldref="1" l10n="U" xml-lang="en-US"><link href="text/sbasic/shared/01010210.xhp" name="Basics">Basics</link></paragraph>
+ <paragraph role="paragraph" id="par_id3156023" l10n="U" xml-lang="en-US" oldref="14">This section provides the fundamentals for working with $[officename] Basic.</paragraph>
+ </section>
+ <paragraph xml-lang="en-US" oldref="2" l10n="U" role="paragraph" id="par_id3147560">$[officename] Basic code is based on subroutines and functions that are specified between <emph>sub...end sub</emph> and <emph>function...end function</emph> sections. Each Sub or Function can call other Subs and Functions. If you take care to write generic code for a Sub or Function, you can probably re-use it in other programs. See also <link href="text/sbasic/shared/01020300.xhp" name="Procedures and Functions">Procedures and Functions</link>.</paragraph>
+ <paragraph role="heading" level="2" id="hd_id3150398" l10n="U" xml-lang="en-US" oldref="3">What is a Sub?</paragraph>
+ <paragraph l10n="U" xml-lang="en-US" role="paragraph" id="par_id3148797" oldref="4"><emph>Sub</emph> is the short form of <emph>subroutine</emph>, that is used to handle a certain task within a program. Subs are used to split a task into individual procedures. Splitting a program into procedures and sub-procedures enhances readability and reduces the error-proneness. A sub possibly takes some arguments as parameters but does not return any values back to the calling sub or function, for example:</paragraph>
+ <paragraph role="paragraph" id="par_id3150868" l10n="U" xml-lang="en-US" oldref="15">DoSomethingWithTheValues(MyFirstValue,MySecondValue)</paragraph>
+ <paragraph role="heading" level="2" id="hd_id3156282" l10n="U" xml-lang="en-US" oldref="5">What is a Function?</paragraph>
+ <paragraph xml-lang="en-US" role="paragraph" id="par_id3156424" l10n="U" oldref="6">A <emph>function</emph> is essentially a sub, which returns a value. You may use a function at the right side of a variable declaration, or at other places where you normally use values, for example:</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3146985" xml-lang="en-US" oldref="7"><emph>MySecondValue = myFunction(MyFirstValue)</emph></paragraph>
+ <paragraph role="heading" level="2" id="hd_id3153364" l10n="U" xml-lang="en-US" oldref="8">Global and local variables</paragraph>
+ <paragraph role="paragraph" id="par_id3151112" l10n="U" xml-lang="en-US" oldref="9">Global variables are valid for all subs and functions inside a module. They are declared at the beginning of a module before the first sub or function starts.</paragraph>
+ <paragraph role="paragraph" id="par_id3154012" l10n="U" xml-lang="en-US" oldref="10">Variables that you declare within a sub or function are valid only inside this sub or function. These variables override global variables with the same name and local variables with the same name coming from superordinate subs or functions.</paragraph>
+ <paragraph role="heading" level="2" id="hd_id3150010" l10n="U" xml-lang="en-US" oldref="11">Structuring</paragraph>
+ <paragraph xml-lang="en-US" role="paragraph" id="par_id3153727" l10n="U" oldref="12">After separating your program into procedures and functions (Subs and Functions), you can save these procedures and functions as files for reuse in other projects. $[officename] Basic supports <link href="text/sbasic/shared/01020500.xhp" name="Modules and Libraries">Modules and Libraries</link>. Subs and functions are always contained in modules. You can define modules to be global or part of a document. Multiple modules can be combined to a library.</paragraph>
+ <paragraph xml-lang="en-US" role="paragraph" id="par_id3152578" l10n="U" oldref="13">You can copy or move subs, functions, modules and libraries from one file to another by using the <link href="text/sbasic/shared/01/06130000.xhp" name="Macro">Macro</link> dialog.</paragraph>
+ </body>
+</helpdocument>