xsharp.eu • For loop syntax. - Page 2
Page 2 of 3

For loop syntax.

Posted: Mon Sep 30, 2019 2:21 pm
by Chris
alanbourke wrote:I created a new FoxPro console application and pasted Matt's code in, still doesn't like 'endfor'.

Seems happy with 'end for' though, but that's not valid VFP syntax
Do you mean that the editor does not highlite it (which is indeed a known problem), or does the compiler not accept it either when building? Tested it here and seems to work ok.

For loop syntax.

Posted: Mon Sep 30, 2019 2:23 pm
by alanbourke
It doesn't highlight it, and it throws a compiler error XS1003, Syntax Error, 'NEXT' expected.

For loop syntax.

Posted: Mon Sep 30, 2019 2:29 pm
by Chris
Could you please zip the solution folder and send it so we can have a look?

For loop syntax.

Posted: Mon Sep 30, 2019 2:30 pm
by alanbourke
Can do

For loop syntax.

Posted: Mon Sep 30, 2019 5:07 pm
by Karl-Heinz
Guys,

Didn´t notice it before, but this code - with the dialect setting <VO> or <Foxpro> - compiles and runs. To see what´s going on i compiled the source with the -ppo+ -showincludes+ -nostddefs+ settings - and the ppo file content still shows "END FOR". I´ve looked at the X# Help but i didn´t find any hint that "END FOR" is a legal statement - but it is :-)

BTW. I´m pretty sure that Alan didn´t select in VS the <Foxpro> dialect, so a not preproccessed "ENDFOR" throws the XS1003, Syntax Error, 'NEXT'

Code: Select all

FUNCTION Start( ) AS VOID
LOCAL i  AS INT 


	FOR i := 1 TO 3 
		
		? i 
		
	END FOR  // <----

	
	
	FOREACH VAR c IN  { "one" , "two" , "three" }
		
		? c 
		
	END FOR  // <---
			
	
RETURN

regards
Karl-Heinz

For loop syntax.

Posted: Tue Oct 01, 2019 8:19 am
by alanbourke
"BTW. I´m pretty sure that Alan didn´t select in VS the <Foxpro> dialect,"

I ran the Visual Studio wizard to create a Foxpro Console Application, which sets the dialect automatically.

'End For' might be valid in other dialects, but it's not valid Visual Foxpro.

For loop syntax.

Posted: Tue Oct 01, 2019 8:32 am
by FFF
Alan,
VS17 community on W8.1/64 German, 2.07 FoxVersion.
New project / FoxPro Console app
modified to
USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text

FUNCTION Start() AS VOID STRICT
? "Hello World! Today is ",ToDay()
LOCAL x AS INT

FOR x = 1 TO 100
? x
// NEXT
// endfor
END FOR
WAIT
RETURN

CTRL-F5 compiles and runs in all three "closing" versions.

For loop syntax.

Posted: Tue Oct 01, 2019 8:48 am
by lumberjack
Hi Alan,
alanbourke wrote:"BTW. I´m pretty sure that Alan didn´t select in VS the <Foxpro> dialect,"
I ran the Visual Studio wizard to create a Foxpro Console Application, which sets the dialect automatically.
'End For' might be valid in other dialects, but it's not valid Visual Foxpro.
Run the Wizard? I assume you mean File/New/Project, Select Foxpro Console Application and Next button to create?

For loop syntax.

Posted: Tue Oct 01, 2019 9:10 am
by alanbourke
Right, at the link below is a 5MB MP4 screen recording showing installation of XSharp and then what I'm doing in Visual Studio.

Demo

For loop syntax.

Posted: Tue Oct 01, 2019 9:14 am
by robert
Alan,
Thanks for the video. I am looking into this

Robert