From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03090410.xhp | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03090410.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03090410.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03090410.xhp b/helpcontent2/source/text/sbasic/shared/03090410.xhp new file mode 100644 index 000000000..dc751a7e8 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03090410.xhp @@ -0,0 +1,68 @@ + + + + + + + Switch Function + /text/sbasic/shared/03090410.xhp + + + + + + +
+ + Switch function + + + +Switch Function +Evaluates a list of arguments, consisting of an expression followed by a value. The Switch function returns a value that is associated with the expression that is passed by this function. +
+ +Syntax: + +Switch (Expression1, Value1[, Expression2, Value2[..., Expression_n, Value_n]]) + + +Parameters: +The Switch function evaluates the expressions from left to right, and then returns the value that is assigned to the function expression. If expression and value are not given as a pair, a runtime error occurs. + Expression: The expression that you want to evaluate. + Value: The value that you want to return if the expression is True. +In the following example, the Switch function assigns the appropriate gender to the name that is passed to the function: + + + +Example: + +Sub ExampleSwitch +Dim sGender As String + sGender = GetGenderIndex( "John" ) + MsgBox sGender +End Sub + +Function GetGenderIndex (sName As String) As String + GetGenderIndex = Switch(sName = "Jane", "female", sName = "John", "male") +End Function + + + +
\ No newline at end of file -- cgit v1.2.3