For loop syntax.

This forum is meant for questions about the Visual FoxPro Language support in X#.

User avatar
Chris
Posts: 4951
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

For loop syntax.

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
alanbourke

For loop syntax.

Post by alanbourke »

It doesn't highlight it, and it throws a compiler error XS1003, Syntax Error, 'NEXT' expected.
User avatar
Chris
Posts: 4951
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

For loop syntax.

Post by Chris »

Could you please zip the solution folder and send it so we can have a look?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
alanbourke

For loop syntax.

Post by alanbourke »

Can do
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

For loop syntax.

Post 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
alanbourke

For loop syntax.

Post 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.
FFF
Posts: 1589
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

For loop syntax.

Post 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.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

For loop syntax.

Post 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?
______________________
Johan Nel
Boshof, South Africa
alanbourke

For loop syntax.

Post 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
User avatar
robert
Posts: 4552
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

For loop syntax.

Post by robert »

Alan,
Thanks for the video. I am looking into this

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply