From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03100700.xhp | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03100700.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03100700.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03100700.xhp b/helpcontent2/source/text/sbasic/shared/03100700.xhp new file mode 100644 index 000000000..14d00c83b --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03100700.xhp @@ -0,0 +1,75 @@ + + + + + + + Const Statement + /text/sbasic/shared/03100700.xhp + + + + + +
+ + Const statement + + +Const Statement +Defines one or more identifiers as constants. +
+A constant is a variable that helps to improve the readability of a program. Constants are not defined as a specific type of variable, but rather are used as placeholders in the code. You can only define a constant once and it cannot be modified. + + + + Const syntax + + +[Global|Private|Public] Const name = expression[, ...] + + + + name: Any identifier that follows the standard variable naming conventions. +expression: Any literal expression. +The data type must be omitted. When a library gets loaded in memory, %PRODUCTNAME Basic converts the program code internally so that each time a constant is used, the defined expression replaces it. +

Scope

+By default constants are defined as private in modules and routines. Constants can be made public or global in order to be used from all modules, from all Basic libraries. +Global, Private and Public specifiers can only be used for module constants. + + + Const EARTH = "♁" ' module scope + Private Const MOON = "☾" ' module scope + Public Const VENUS="♀", MARS="♂" ' general scope + Global Const SUN = "☉", STAR = "☆" ' general scope + + Sub ExampleConst + Const SUN = 3 * 1.456 / 56 ' SUN is local + MsgBox SUN,, MOON ' SUN global constant is unchanged + Const Pgm = "Program", Var = 1.00 + MsgBox Pgm & " " & Var, , VENUS &" and "& MARS + End Sub + +
+ Enum statement + Type statement +
+ + +
\ No newline at end of file -- cgit v1.2.3