I do not know why the "unexpected if" always appear when I input the if?? somebody know the reason?
There is no condition after the if statement for example
if yourVariable is true print "true"else print "false"
Also, correction indention after the if statement is important.
"If the event occurs" is already covered by the line above with the "On Events.DragEnd". If (see what I did there) you have an extra condition to check for, then you need to describe that after the if word as Peter described above.