Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Single exit-point
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00640316
Message ID:
00640580
Views:
28
>>>>>>>Hi Sergey,
>>>>>>>
>>>>>>>>< pre >
>>>>>>>>Or even shorter
LOCAL llresult
>>>>>>>>llresult = .T.
>>>>>>>>llresult = llresult And StepOne()
>>>>>>>>llresult = llresult And StepTwo()
>>>>>>>>llresult = llresult And StepThree()
>>>>>>>>
>>>>>>>
>>>>>>>How about,
>>>>>>>
llresult = StepOne() AND StepTwo() AND StepThree()
>>>>>>Return llresult
>>>>>>
>>>>>>
>>>>>>OR
>>>>>>
RETURN StepOne() AND StepTwo() AND StepThree()
>>>>>>
>>>>>>:-)
>>>>>
>>>>>BTW, how about
>>>>>
>>>>>
RETURN StepThree(StepTwo(StepOne()))
>>>>>
>>>>>:)
>>>>
>>>>This version is incorrect, unfortunately... :) You would have to call each method and you would have to check for parameters passed...
>>>
>>>No, it is correct. I assume the Step procedures know what to do themselves.
>>>
>>>Try something like:
>>>
>>>
>>>set procedure to steps
>>>lCheck = step3(step2(step1()))
>>>lCheck = step3(step2(step1(.t.)))
>>>
>>>*** Steps.prg
>>>PROCEDURE step1
>>>	LPARAMETER tl1
>>>	* lResult = [you may do something logical here]
>>>	lResult = tl1 && just as a default value
>>>RETURN lResult
>>>
>>>PROCEDURE step2
>>>	LPARAMETER tl1
>>>	* do something
>>>	lResult = tl1 AND .T. && OR some other valid logical expression instead of just .t.
>>>RETURN lResult
>>>
>>>PROCEDURE step3
>>>	LPARAMETER tl1
>>>	* do something
>>>	lResult = tl1 AND .T. && R OR some other valid logical expression instead of just .t.
>>>RETURN lResult
>>>
>>>
>>
>>Well, with this assumption it would work... But it was not that clear from the original BR :) ("postanovka zadachi" - what's the correct English term?)
>>
>>And you still have to call all three methods while in the first version you don't have to if one of them failed.
>
>The contest started about the shortest one, not the fastest one... :)

In the real life the rear person would sacriface the perfomance to the shorter volume of code... Nobody is being paid by the lines of code and besides, in this case you probably would like to make it longer... :))

BTW, how about "Postanovka zadachi"?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform