Page 1 of 1

Error messages - Missing counter after Next in For statement

Posted: 02 Aug 2010 03:51
by allenandholmes
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

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

Posted: 02 Aug 2010 15:30
by ranko.rankovic
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

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

Posted: 04 Aug 2010 11:43
by allenandholmes
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