General information
Category:
Coding, syntax & commands
>So there I am... taking the 10 random quiz questions. I get one that says something like: "What do you get when you run this?
>
>x = 7
>y = 8
>IF X > 3 .AND Y < 4
>WAIT WINDOW "X > 3, Y < 4"
>ELSE
>WAIT WINDOW "X <= 3 and/or y >= 4"
>ENDIF
>
>a.WAIT WINDOW "X > 3, Y < 4"
>b.WAIT WINDOW "X <= 3 and/or y >= 4"
>c.Bad Command
>d.Both windows"
>
>So I chose c. But then it said I was wrong. So I copied it and ran it and it gave me a bad command error. I use VFP6 and the question stated VFP3 but I didn't think it changed like this. Can anybody expound on this matter and hopefully untarnish my pride?! Oh well, I just got over it!
>
>Mike Helland
Yes. It's an example from the Hacker's Guide to VFP 3.0.
Apparently in VFP 3.0 and before you were allowed to place comments on the same line as your if statement. The way that FP dealt with that is as soon as it hit a syntax error it would just make the rest of the line a comment.
In this example the missing "." in the "AND" is what is causing the problem. It evaluates only the first part of the if and the rest of the if it just acts as if its a comment.
HTH
Dan
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only