none
Expected endif doesnt work? RRS feed

  • Question

  • sorry that i cant show the code because it wont let me. Anyway the problem is that it says expected end if in 60,1. Even if i have a endif in it. I have tried to run small Basic as admistrator but i doesnt work either.

    For the Horde!!!

    Thursday, November 19, 2015 5:49 PM

Answers

  • I expect there is something wrong with the sequence of endfor and endif etc.

    When you format the program ( rightclick in the program and in the submenu choose Format program) , then you can see how Small Basic interprets the loops by showing indents for every loop. When you cannot find the problem, you can copy/paste the program here on the forum in the textblock. I suspect you cannot publish code in a codeblock if you are new here.


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Thursday, November 19, 2015 6:30 PM
    • Proposed as answer by litdevModerator Thursday, November 19, 2015 6:48 PM
    • Marked as answer by Vaarna Sunday, November 22, 2015 12:10 PM
    Thursday, November 19, 2015 6:29 PM
    Answerer

All replies

  • I expect there is something wrong with the sequence of endfor and endif etc.

    When you format the program ( rightclick in the program and in the submenu choose Format program) , then you can see how Small Basic interprets the loops by showing indents for every loop. When you cannot find the problem, you can copy/paste the program here on the forum in the textblock. I suspect you cannot publish code in a codeblock if you are new here.


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Thursday, November 19, 2015 6:30 PM
    • Proposed as answer by litdevModerator Thursday, November 19, 2015 6:48 PM
    • Marked as answer by Vaarna Sunday, November 22, 2015 12:10 PM
    Thursday, November 19, 2015 6:29 PM
    Answerer
  • TextWindow.Title = "Lore"
    TextWindow.ForegroundColor = "yellow"
    TextWindow.Write("Nimeä hahmosi : ")
    onimi= TextWindow.Read()
    TextWindow.WriteLine("Nouset maanalaisesta horroksestasi etkä muista muuta kuin nimesi... " + onimi )
    Program.Delay(1000)
    TextWindow.Clear()
    pohjoinen = 0
    itä = 0

    perus:

    TextWindow.backgroundColor = "black"
    TextWindow.Write("+ ")
    tekeminen = TextWindow.Read()


    If tekeminen = "p" Then 
      pohjoinen = pohjoinen + 1
     
     
      Goto perus
     
    ElseIf tekeminen = "e" then
      pohjoinen = pohjoinen - 1
     
     
      Goto perus
     
     
    elseIf tekeminen = "i" then
      itä = itä + 1
     
     
      Goto perus
     
     
      If tekeminen = "l" then
        itä = itä - 1
       
        Goto perus
       
       
      elseIf tekeminen = "s" then
        TextWindow.WriteLine("+ suuntavaistosi mukaan sijaintisi on " + pohjoinen + ", " + itä) 
        Program.Delay(1150)
        Goto perus
       
      Else
        TextWindow.BackgroundColor = "red"
        TextWindow.WriteLine("Tuntematon Komento!")
        Goto perus
       
       endif


    For the Horde!!!

    Sunday, November 22, 2015 12:18 PM
  • Line 38 :If tekeminen = "l"   should be  ElseIf tekeminen = "l"

    Then there is no error anymore.


    Jan [ WhTurner ] The Netherlands

    Sunday, November 22, 2015 3:16 PM
    Answerer
  • Thanks! =]

    For the Horde!!!

    Monday, November 23, 2015 8:54 AM