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/03090103.xhp | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03090103.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03090103.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03090103.xhp b/helpcontent2/source/text/sbasic/shared/03090103.xhp new file mode 100644 index 000000000..07b6e453d --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03090103.xhp @@ -0,0 +1,67 @@ + + + + + +IIf Function +/text/sbasic/shared/03090103.xhp + + +Sun Microsystems, Inc. + + + +
+IIf function + +

IIf Function

+Returns one of two possible function results, depending on the logical value of the evaluated expression. +
+ + +IIf (Expression, ExpressionTrue, ExpressionFalse) + + + +Expression: Any expression that you want to evaluate. If the expression evaluates to True, the function returns the result of ExpressionTrue, otherwise it returns the result of ExpressionFalse. + +ExpressionTrue, ExpressionFalse: Any expression, one of which will be returned as the function result, depending on the logical evaluation. +IIf evaluates both ExpressionTrue and ExpressionFalse even if it returns only one of them. If one of the expressions results in error, the function returns the error. For example, do not use IIF to bypass a possible division by zero result. + + + + +REM Returns the maximum of 3 values +Function Max (A As Double, B As Double, C, As Double) As Double + Max = IIf( A >= B, A, B) + Max = IIf( C >= Max, C, Max) +End Function +REM Bad usage of function IIf +Function Inverse(A As Double) As Double + Inverse = IIf( A = 0, 0, 1/A ) +End Function + + +
+ If or Select Case statements + Switch function +
+ + +
-- cgit v1.2.3