MasteringVFP/2/6/1
出自VFP Wiki
Procedure
程序,我們可以將常用的指令集合到一起~這樣就不必再剪貼那麼多程式碼了~
例如:
use customers go top locate for cust_id=="A" if found() && do something endif use in customers use customers go top locate for cust_id=="B" if found() && do something endif use in customers
我們就可以化簡為:
do findCustomer with "A" do findCustomer with "B" procedure findCustomer lparameters lc_id use customers go top locate for cust_id==lc_id if found() && do something endif use in customers endproc
這樣不是簡單許多嗎?? 一般來說, Procedure 是不會傳回值的,但 VFP 的 Procedure 比較特別,它可以傳回值也可以不傳回值.