for next loop problem?
07-06-2011 20:50
Member
Number of reported issues by jack: 2
for next loop problem?

I have a problem finding where the fault is in this code, as is it gives the error
NEXT Without FOR or FOR without NEXT
but if you comment out the bottom for/next loop it works.

```Declare Function y0 CDECL Lib "msvcrt.dll" Alias "_y0" (ByVal x As Double) As Double
Declare Function y1 CDECL Lib "msvcrt.dll" Alias "_y1" (ByVal x As Double) As Double
Declare Function yn CDECL Lib "msvcrt.dll" Alias "_yn" (ByVal n As Integer, ByVal x As Double) As Double
Declare Function j0 CDECL Lib "msvcrt.dll" Alias "_j0" (ByVal x As Double) As Double
Declare Function j1 CDECL Lib "msvcrt.dll" Alias "_j1" (ByVal x As Double) As Double
Declare Function jn CDECL Lib "msvcrt.dll" Alias "_jn" (ByVal n As Integer, ByVal x As Double) As Double
Uses "console"
Dim c, n As Long
Dim x As Ext
x = 2.387
n = 3
Console_WriteLine "Bessel functions for x = "&Format\$(x, 16 )
Console_WriteLine " Kind   Order  Function     Result"
Console_WriteLine " First  0      j0( x )     "&Format\$(j0( x ), 16 )
Console_WriteLine " First  1      j1( x )     "&Format\$(j1( x ), 16 )
For c = 2 To 4
Console_WriteLine " First  "&LTrim\$(Str\$(c))&"      jn("&Str\$(c)&", x )  "&Format\$(jn( c, x ), 16 )
Next
Console_WriteLine " Second 0      y0( x )     "&Format\$(y0( x ), 16 )
Console_WriteLine " Second 1      y1( x )     "&Format\$(y1( x ), 16 )
For c = 2 To 4
Console_WriteLine" Second "&LTrim\$(Str\$(c))&"      yn( "&Str\$(c)&", x )  "&Format\$(yn( c, x ), 16 )
Next
Console_WriteLine "All done. Press any key to finish"
Console_WaitKey
```
Issue Details
Issue Number 289
Project thinBasic
Category Unknown
Status Fixed
Priority 10 - Lowest
Affected Version 1.8.7
Fixed Version 1.8.9
Milestone thinBasic 1.8.9.0
Users able to reproduce bug 0
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)

07-06-2011 20:56
Member
never mind, the offending line was
```Console_WriteLine" Second "&LTrim\$(Str\$(c))&"      yn( "&Str\$(c)&", x )  "&Format\$(yn( c, x ), 16 )
```
the problem, no space between Console_WriteLine and the argument

08-06-2011 05:56
thinBasic author
Thanks for reporting.
I will in any case check because it should not report such runtime error

Thanks
Eros

PS: Jack you can use more comfortable PRINT and /or PRINTL console statemente instead of Console_Write and/or Console_WriteLine.