From https://help.libreoffice.org/25.2/en-US/text/sbasic/shared/03090101.html (where the Syntax paragraph is correct) see https://help.libreoffice.org/25.2/media/helpimg/sbasic/Else_fragment.svg Expected : no "condition -- then -- " Note: referring to 25.2 to get latest changes, but already there in "latest".
Note: the example given on the page is not the brightest, comparing days first :/
Thanks for your report Indeed, many examples are 14 years old. What do you suggest? There could be 2 to 3 different examples
(In reply to Alain Romedenne from comment #2) > suggest? To keep the existing, just use Date consistently (see also tdf#131332) >>> Dim sInput As String Dim dInput As Date sInput = InputBox("Enter the expiration date (YYYY-MM-DD)") dInput = DateValue(sInput) If dInput < Date() Then MsgBox "The expiration date has passed" ElseIf dInput > Date() Then MsgBox "The expiration date has not yet passed" Else MsgBox "The expiration date is today" End If <<< and to examplify a shortened too, maybe : >>> Dim sInput As String Dim dInput As Date On error goto inputError sInput = InputBox("Enter the expiration date (YYYY-MM-DD)") dInput = DateValue(sInput) If dInput < Date() Then MsgBox "The expiration date has passed" ElseIf dInput > Date() Then MsgBox "The expiration date has not yet passed" Else MsgBox "The expiration date is today" End If inputError: If dInput = 0 Then MsgBox "Invalid input" <<<
Alain Romedenne committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/2fed269e1f9315e50e277c54ffc1053d48385ca9 tdf#162470 Fix to If statement syntax diagram