Android Question Error description: Missing Keyword: end sub, but there is End If

dais

Member
Licensed User
Longtime User
There is a code:
B4X:
Sub p_OrientationChanged (Azimuth As Float, Pitch As Float, Roll As Float)
    r=Ceil(Roll)
    If r>0 Then
    crossx=crossx+5
    Else
    crossx=crossx-5
    End If
   
    If crossx>740 Then crossx=740
    End If
    crossx=crossx+1
    If crossx<40 Then
    crossx=40
    End If
   
End Sub
So, it shows me error with Error description: Missing Keyword: end sub
How could it be end sub needed here? Am I missing something?
I saw similar post here https://www.b4x.com/android/forum/t...issing-keyword-end-sub-while-not-needed.9849/ , but I can not understand what is wrong with code?
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
It should be "Else If" not just "Else".
 
Upvote 0

dais

Member
Licensed User
Longtime User
Thank you. My bad for Else If, but now it shows the same error for End If after If crossx>740Then crossx=740,
what's wrong with it?
 
Upvote 0
Top