Compiling error "Missing Keyword: end sub" while not needed

Discussion in 'Android Questions' started by TrueBypass, Jun 22, 2011.

  1. TrueBypass

    TrueBypass Member Licensed User

    Hello everyone.
    I wrote the following code in my project:
    Code:
    Sub Activity_Touch (Action As Int, X As Float, Y As Float)
       
    If Y > Ball.Height / 2 + Ball.Top AND Line < 5 Then AND Bln = True
          Bln = 
    False
          Line = Line + 
    1
          Ball.Top = Ball.Top + Ball.Height
          Tmr.Enabled = 
    True
       
    Else
          
    If Y < Ball.Height /2 + Ball.Top AND Line > 1 Then AND Bln = True
             Bln = 
    False
             Line = Line - 
    1
             Ball.Top = Ball.Top - Ball.Height 
             Tmr.Enabled = 
    True
          
    End If        'line 45
       End If
    End Sub
    And when I try to compile it, I get the error:
    Although this is not a new sub.

    Can I get some help? Thanks.
     
  2. XverhelstX

    XverhelstX Well-Known Member Licensed User

    I'm not sure, but set your 2 "then" behind bln= true so: AND bln=true then

    Sent from my SE Xperia Play using Tapatalk.
     
  3. klaus

    klaus Expert Licensed User

    In your code you have a condition after the Then keyword!
    Code:
    Sub Activity_Touch (Action As Int, X As Float, Y As Float)
      
    If Y > Ball.Height / 2 + Ball.Top AND Line < 5 [COLOR=red]Then[/COLOR] AND Bln = True
        Bln = 
    False
        Line = Line + 
    1
        Ball.Top = Ball.Top + Ball.Height
        Tmr.Enabled = 
    True
      
    Else
        
    If Y < Ball.Height /2 + Ball.Top AND Line > 1 [COLOR=red]Then[/COLOR] AND Bln = True
          Bln = 
    False
          Line = Line - 
    1
          Ball.Top = Ball.Top - Ball.Height 
          Tmr.Enabled = 
    True
        
    End If        'line 45
      End If
    End Sub
    You code could look like this:
    Code:
    Sub Activity_Touch (Action As Int, X As Float, Y As Float)
      
    If Bln = True
        
    If Y > Ball.Height / 2 + Ball.Top AND Line < 5 Then
          Line = Line + 
    1
          Ball.Top = Ball.Top + Ball.Height
          Tmr.Enabled = 
    True
        
    Else If Y < Ball.Height /2 + Ball.Top AND Line > 1 Then
          Line = Line - 
    1
          Ball.Top = Ball.Top - Ball.Height 
          Tmr.Enabled = 
    True
        
    End If
        Bln = 
    False
      
    End If
    End Sub
    Best regards.
     
  4. TrueBypass

    TrueBypass Member Licensed User

    Oh, thanks.
    I didn't notice that since I wrote the "AND Bln = True" later on and I forgot to change it.
    :signOops:
    (Problem solved)
     
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