Rule for a "Long press" switch does not work

I would like to implement a rule to check if a button of a switch is pressed “Long”. Therefore I use following rule:

var Timer tTaste = null rule "Taste auswerten"

rule "WohnenSchlafenTaster_long"

when
	Item Taster_Wohnen_Schlafen_Eingang_Taster_Wohnen_Schlafen_Eingang changed
then
	tTaste?.cancel
	
	if(newState == ON) {
		tTaste = createTimer(now.plusNanos(2000000000),[| // 2000 Millisekunden
		
		// Befehl: langer Tastendruck erkannt
		logInfo("Taster WohnenSchlafen", "langer Tastendruck erkannt")
		KNX_Device_Aktor_A3_Wohnen_Licht_Esstisch.sendCommand(ON)
	      ])
	} else {
	if(!(tTaste.hasTerminated)) {
		
		// Befehl: kurzer Tastendruck erkannt
		logInfo("Taster WohnenSchlafen", "kurzer Tastendruck erkannt")
		KNX_Device_Aktor_A3_Licht_Wohnen_Wohnen_Licht_Durchgang.sendCommand(ON)
	}
	}
end

which gives me this error log:

 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'WohnenSchlafenTaster_long.rules'
 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'WohnenSchlafenTaster_long.rules' has errors, therefore ignoring it: [3,1]: mismatched input 'rule' expecting 'when'```

Can someone tell me pls what this error means and how I need to change the rule?

Thanks!

var Timer tTaste = null rule “Taste auswerten”

rule “WohnenSchlafenTaster_long”

when
Item Taster_Wohnen_Schlafen_Eingang_Taster_Wohnen_Schlafen_Eingang changed
then

You added rule “Taste auswerten” behind the timer definition (on that same line). It expects a when on the next line and is complaining that it finds rule "WohnenSchlafenTaster_long" instead.

So remove rule "Taste auswerten".

You can do } else if {

yeah thanks for the inputs - it works now!