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

Discussion in 'Android Questions' started by dais, Mar 28, 2015.

  1. dais

    dais Member Licensed User

    There is a code:
    Code:
    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 http://www.b4x.com/android/forum/th...issing-keyword-end-sub-while-not-needed.9849/ , but I can not understand what is wrong with code?
     
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    It should be "Else If" not just "Else".
     
  3. dais

    dais Member Licensed 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?
     
  4. klaus

    klaus Expert Licensed User

    This is wrong:
    If crossx > 740 Then crossx = 740
    End If


    It should be:
    If crossx > 740 Then crossx = 740
    without the End If

    or
    If crossx > 740 Then
    crossx = 740
    End If
     
    RandomCoder and DonManfred like this.
  5. dais

    dais Member Licensed User

    Thank you, klaus!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice