Error messages - Missing counter after Next in For statement

Post your requests and ideas on the future development of mikroBasic PRO for AVR.
Post Reply
Author
Message
allenandholmes
Posts: 32
Joined: 23 Dec 2009 22:48
Location: Melbourne, Australia

Error messages - Missing counter after Next in For statement

#1 Post by allenandholmes » 02 Aug 2010 03:51

Currently, if you forget to include the counter following Next in a For statement there are nine error messages displayed: 303, 301 (x2), 304 (x6). This mistake is easy to do particularly if you are switching between other third-party versions of Basic (e.g. MS Visual Basic Express) or Fortran, and MikroBasic Pro. Might I suggest a specific test/error message for this?
Regards,
Allen
Regards,
Allen

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: Error messages - Missing counter after Next in For state

#2 Post by ranko.rankovic » 02 Aug 2010 15:30

Hello allenandholmes,

Please can you demonstrate this with some little example, so we can look deeper into it.

Thank you in advance for help.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

allenandholmes
Posts: 32
Joined: 23 Dec 2009 22:48
Location: Melbourne, Australia

Re: Error messages - Missing counter after Next in For state

#3 Post by allenandholmes » 04 Aug 2010 11:43

Herewith further information as required:

Code: Select all

sub procedure LCD_Line_Reset()
  'it is necessary to call this routine prior to each LCD line being processed.
  dim i as byte
  '
  for i = 0 to (G_LCD_LINECHARS - 1)
    G_LCD_Line[i] = ""
  next
end sub
Gives following error messages:

(I have removed other unnecessary messages)

259 1010 Hint: Unit "errors.mbas" has been recompiled errors.mbas
1 1015 Hint: Compiling unit "J:\mikroBasic Pro Projects\lcd.mbas" lcd.mbas
49 303 Identifier "end" was not declared lcd.mbas
49 301 "sub"is not valid identifier lcd.mbas
51 301 "procedure"is not valid identifier lcd.mbas
51 304 Syntax error: Expected "end" but "LCD_Scroll_Array_Reset" found lcd.mbas
51 304 Syntax error: Expected "sub" but "(" found lcd.mbas
51 304 Syntax error: Expected "end" but ")" found lcd.mbas
53 304 Syntax error: Expected "sub" but "dim" found lcd.mbas
53 304 Syntax error: Expected "end" but "i" found lcd.mbas
53 304 Syntax error: Expected "." but "," found lcd.mbas
8 307 File "lcd.mcl" not found initialisemcu.mbas

The 2nd last line of the above Basic code should have been "next i"

0 102 Finished (with errors): 04 Aug 2010, 20:31:54 Project 201007.mbpav
Regards,
Allen

Post Reply

Return to “mikroBasic PRO for AVR Wish List”