Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Chaining commands
Message
From
29/01/2008 12:24:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
29/01/2008 11:55:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01286728
Message ID:
01286754
Views:
22
>This is probably a dumb question but . . . in VFP is there a way to chain multiple commands on a single line? Something like:
>
>x=4|y=6|x=14
>
>I've never seen this form but several other languages allow it.

No, since ENTER is the end-of-command marker.

But often there are shortcuts, which you may also use to make code more compact (and unreadable).

Here is one:
if x
  Function1()
endif

* may be wirten in a single line as follows:
iif(x, Function1(), "")
I sometimes used it when there are many similar groups of commands: if option1 is selected run report1, if option2 is selected run report 2, etc. - but it must be used with care, since the result can be difficult to read. Just as when you chain commands as you were hoping to achieve.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform