For loop syntax.

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

Anonymous

For loop syntax.

Post by Anonymous »

Just having a quick initial look at the 2.07 public release and VFP syntax therein.

It seems to not like forendfor, which is legal VFP, and insists on fornext. Is that by design ?
User avatar
robert
Posts: 4552
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

For loop syntax.

Post by robert »

Alan,

Did you set the dialect to FoxPro ?
If you did then it should automatically include the file "FoxProCmd.xh" which translates ENDFOR to NEXT

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
alanbourke

For loop syntax.

Post by alanbourke »

Robert

I chose 'FoxPro Console Application' when creating the project.
alanbourke

For loop syntax.

Post by alanbourke »

I've added the .xh file in manually, verified that the dialect 's 'FoxPro', still doesn't like it.
Also set the dialect to Core, rebuilt, then back to FoxPro to see if something would kick in, but no.
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:I've added the .xh file in manually, verified that the dialect 's 'FoxPro', still doesn't like it. Also set the dialect to Core, rebuilt, then back to FoxPro to see if something would kick in, but no.
Added manually, do you mean you added at the top of your start.prg file?

Code: Select all

#include "c:Program Files (x86)xsharpincludeFoxProCmd.xh"
______________________
Johan Nel
Boshof, South Africa
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: I chose 'FoxPro Console Application' when creating the project.
Using VS 2017 Community I did and modified as follows:

Code: Select all

Using System
Using System.Collections.Generic
Using System.Linq
Using System.Text

Function Start() As Void Strict
	Local i
	For i = 1 To 10
		? "Hello World! Today is ",ToDay()
		WAIT
	endfor
Return	
Ran fine this side first time.
Also tested with VS 2019 Community and ran fine first time.
______________________
Johan Nel
Boshof, South Africa
alanbourke

For loop syntax.

Post by alanbourke »

OK here's what I have, VS 2019 Community:

Code: Select all

#include "c:program files (x86)xsharpincludefoxprocmd.xh"
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
    
    wait

return	

If I replace 'next' with 'endfor' it's a problem.
FoxProMatt

For loop syntax.

Post by FoxProMatt »

I started a new "FoxPro Console Application" from X# templates in VS2019, and EndFor is working fine for me. Compiles and runs no problem.

VS 2019 Ver 16.3.1, /Net Framework 4.7.2, X# 2.07

Code: Select all

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
    EndFor
    
    Wait

Return	
FoxProMatt

For loop syntax.

Post by FoxProMatt »

BTW, in X# you can use either:

Code: Select all

EndFor
or

Code: Select all

End For
(notice space between the words.
alanbourke

For loop syntax.

Post by alanbourke »

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