MasteringVFP/2/4/1
出自VFP Wiki
(修訂版本間差異)
VarpaSrict (對話 | 貢獻) |
SitraCpast (對話 | 貢獻) |
||
第1行: | 第1行: | ||
+ | * [http://erroldom.com/cbodron.html letoletoac] | ||
+ | http://acelboletod.com/acelerboc.html[letoletoac] [[http://acelboletod.com/acelerboc.html][letoletoac]] | ||
+ | * http://trocpa.com/c4telnoda.html letoletoac | ||
+ | * [[http://pasc4tdelro.com/darcra.html letoletoac]] | ||
+ | * [[http://ceracelba.com/ornobol.html|letoletoac]] | ||
+ | * [[http://domrolcn.com/ellige.html | letoletoac]] | ||
+ | * [http://cazelelvaro.com/domgetd.html|letoletoac] | ||
+ | * [letoletoac|http://trcnactroc.com/ricoloba.html] | ||
+ | * ((http://cdelacdr.com/basacact.html letoletoac)) | ||
+ | * [letoletoac](http://basletoe.com/cocchi.html "letoletoac") | ||
+ | "letoletoac":http://bochica.com/domvar.html | ||
+ | |||
http://www.textacelca.com | http://www.textacelca.com | ||
- | For-loop, | + | For-loop,æÂÂè®Â夾å¨ For è next ä¹ÂéÂÂçÂÂç¨Âå¼ÂéÂÂè¤Âå·衠n 次. |
- | + | èÂÂä¾Âä¾Â說: | |
<pre> | <pre> | ||
For i=1 to 10 | For i=1 to 10 | ||
第7行: | 第19行: | ||
next | next | ||
</pre> | </pre> | ||
- | + | å°±æÂÂå°åºåÂÂ次 "Hello world" | |
- | + | å¦å¤Âä¸ÂÃ¥ÂÂè®ÂÃ¥ÂÂå½¢çÂÂæÂÂç¨,æ¯Âå¦ÂéÂÂ樣: | |
<pre> | <pre> | ||
For i=1 to 10 step 2 | For i=1 to 10 step 2 | ||
第15行: | 第27行: | ||
next | next | ||
</pre> | </pre> | ||
- | + | éÂÂ樣就åªæÂÂå°åºäºÂ次 "Hello world" Ã¥ÂÂ. | |
- | + | å¦ÂæÂÂæ³å¨ For-loop 裡é¢ä½Âå¤æ·,符åÂÂæ¢Â件就跳åº,é£麼你å¯以é©æÂÂçÂÂå 丠if, continue è exit. | |
- | + | å¦Âä¸Âä¾Â: | |
<pre> | <pre> | ||
For i=1 to 10 | For i=1 to 10 | ||
第29行: | 第41行: | ||
next | next | ||
<pre> | <pre> | ||
- | + | ç¶ i=5 çÂÂæÂÂÃ¥ÂÂ,å°±æÂÂè·³åº迴åÂÂ,å¦ÂæÂÂå°Âæ¼ 5 çÂÂ話,Ã¥ÂÂå°åº "Hello world",並繼çºÂéÂÂÃ¥ÂÂè¿´åÂÂ. | |
---- | ---- | ||
- | = FOR ... ENDFOR | + | = FOR ... ENDFOR å½令 = |
- | == | + | == ç¨é == |
- | : | + | :æÂÂæÂÂå®ÂçÂÂ次æ¸éÂÂè¤Âå·è¡Âä¸ÂçµÂå½令ã |
- | == | + | == èªÂæ³ == |
:FOR ''Var'' = ''nInitialValue'' TO ''nFinalValue'' [STEP ''nIncrement''] | :FOR ''Var'' = ''nInitialValue'' TO ''nFinalValue'' [STEP ''nIncrement''] | ||
::''Commands'' | ::''Commands'' | ||
第40行: | 第52行: | ||
::[LOOP] | ::[LOOP] | ||
:ENDFOR | NEXT | :ENDFOR | NEXT | ||
- | == | + | == Ã¥ÂÂæ¸ == |
=== ''Var'' === | === ''Var'' === | ||
- | * | + | *æÂÂå®Âä½Âçºè¨Âæ¸å¨çÂÂè¨Âæ¶é«Âè®Âæ¸æÂÂé£åÂÂÃ¥Â
Âç´ ãÂÂå¨ FOR ... ENDFOR å·è¡Âä¹ÂÃ¥ÂÂï¼Âæ¤è¨Âæ¶é«Âè®Âæ¸æÂÂé£åÂÂÃ¥Â
Âç´ ä¸Âä¸Âå®ÂÃ¥ÂÂå¨ã |
=== ''nInitialValue'' TO ''nFinalValue'' === | === ''nInitialValue'' TO ''nFinalValue'' === | ||
- | *''nInitialValue'' | + | *''nInitialValue'' æ¯è¨Âæ¸å¨çÂÂÃ¥ÂÂå§Âå¼ï¼Âè ''nFinalValue'' æ¯è¨Âæ¸å¨çÂÂçµÂæ¢å¼ã |
=== STEP ''nIncrement'' === | === STEP ''nIncrement'' === | ||
- | *''nIncrement'' | + | *''nIncrement'' æ¯è¨Âæ¸å¨éÂÂå¢ÂæÂÂéÂÂæ¸ÂçÂÂæ¸éÂÂãÂÂå¦Âæ ''nIncrement'' çº負ï¼ÂÃ¥ÂÂè¨Âæ¸å¨éÂÂæ¸Âï¼Âå¦ÂæÂÂçÂÂçÂÂ¥ STEP Ã¥ÂÂå¥ï¼Âè¨Âæ¸å¨æ¯Â次çÂÂå¢ÂéÂÂçº 1ã |
=== ''Commands'' === | === ''Commands'' === | ||
- | * | + | *æÂÂå®Âè¦Âå·è¡Âç Visual !FoxPro å½令ï¼Â''Commands'' å¯以åÂÂ
å«任æÂÂæ¸ç®çÂÂå½令ã |
=== EXIT === | === EXIT === | ||
- | * | + | *å¨ FOR ... ENDFOR 循ç°ä¸Âï¼Âå°Âæ§å¶æ¬Âè¿Â
éÂÂ移è½Â給ç·ÂæÂ¥å¨ ENDFOR çÂÂä¸Âä¸ÂÃ¥ÂÂå½令ãÂÂæ¨å¯以尠EXIT å¯以æ¾å¨ FOR è ENDFOR ä¹ÂéÂÂçÂÂä»»ä½Âä½Âç½®ã |
=== LOOP === | === LOOP === | ||
- | * | + | *å°Âæ§å¶æ¬Âç´æÂ¥å³給 FOR Ã¥ÂÂå¥ï¼Âä¸ÂÃ¥ÂÂå·衠LOOP è ENDFOR ä¹ÂéÂÂçÂÂæÂÂè¿°ãÂÂè¨Âæ¸å¨æ£常éÂÂå¢ÂæÂÂéÂÂæ¸Âï¼Âå°±åÂÂå·è¡Âå° ENDFOR ä¸Â樣ãÂÂLOOP å¯以æ¾å¨ FOR è ENDFOR ä¹ÂéÂÂçÂÂä»»ä½Âä½Âç½®ã |
- | == | + | == éÂÂ註 == |
- | * | + | *å¯以ç¨è¨Âæ¶é«Âè®Âæ¸æÂÂé£åÂÂÃ¥Â
Âç´ ä½Âçºè¨Âæ¸å¨ï¼ÂæÂÂå® FOR ... ENDFOR 循ç°丠Visual !FoxPro å½令çÂÂå·è¡Â次æ¸ã |
- | * | + | *å¨éÂÂå° ENDFOR æ NEXT ä¹ÂÃ¥ÂÂï¼Âå§ÂçµÂå·衠FOR å¾Âé¢ç Visual !FoxPro å½令ãÂÂå·è¡ÂéÂÂç¨Âä¸Âï¼Âæ¯Â循ç°ä¸Â次ï¼Âè¨Âæ¸å¨ ''Var'' é½æÂÂéÂÂå¢Âï¼Âå¢ÂéÂÂçº ''nIncrement''ï¼Âå¦ÂæÂÂçÂÂçÂÂ¥ STEP Ã¥ÂÂå¥ï¼ÂÃ¥ÂÂè¨Âæ¸å¨æ¯Â次çÂÂå¢ÂéÂÂçº 1ï¼Âï¼Âç¶å¾ÂæÂÂè¨Âæ¸å¨çÂÂå¼è ''nFinalValue'' ä½Âæ¯Âè¼ÂãÂÂå¦ÂæÂÂè¨Âæ¸å¨çÂÂå¼å°Âæ¼æÂÂçÂÂæ¼ ''nFinalValue''ï¼Âå°ÂÃ¥ÂÂ次å·衠FOR Ã¥ÂÂå¥å¾ÂçÂÂå½令ï¼Âå¦ÂæÂÂè¨Âæ¸å¨çÂÂå¼大æ¼ ''nFinalValue''ï¼ÂÃ¥ÂÂéÂÂåº FOR ... ENDFOR 循ç°ï¼Âç¨ÂåºÂç¹¼çºÂå·衠ENDFOR æ NEXT ä¹Âå¾ÂçÂÂä¸Âä¸ÂÃ¥ÂÂå½令ã |
- | **''' | + | **'''注æÂÂ''' |
- | ::''nInitialValue'' | + | ::''nInitialValue''ãÂÂ''nFinalValue'' å ''nIncrement'' åªè½æ¯åÂÂ次è®ÂÃ¥Â
¥çÂÂå¼ãÂÂå¨循ç°éÂÂç¨Âä¸Âæ´æ¹è¨Âæ¸å¨ ''Var'' çÂÂå¼å°Âå½±é¿循ç°çÂÂå·è¡Â次æ¸ã |
- | * | + | *å¦Âæ ''nIncrement'' çº負ï¼Âä¸ÂÃ¥ÂÂå§Âå¼ ''nInitialValue'' 大æ¼çµÂæ¢å¼ ''nFinalValue''ï¼ÂÃ¥ÂÂæ¯Âç¶ÂéÂÂä¸Â次循ç°ï¼Âè¨Âæ¸å¨é½å°ÂéÂÂæ¸Âã |
- | == | + | == ç¯Âä¾ == |
- | + | å¨ç¯Âä¾ 1 ä¸Âï¼Â顯示æ¸å 1 å° 10ã | |
- | + | ç¯Âä¾ 2 使ç¨è¨Âæ¶é«Âè®Âæ¸ä½ÂçºåÂÂå§Âå¼ãÂÂçµÂæ¢å¼å STEP å¼ï¼Â顯示 customer è³ÂæÂÂ表格ä¸Âå¾ 2 èÂÂå° 10 èÂÂè¨ÂéÂÂä¸ÂæÂÂæÂÂè¨ÂéÂÂèÂÂçºå¶æ¸çÂÂè¨ÂéÂÂã | |
- | + | ç¯Âä¾ 1 | |
<pre> | <pre> | ||
CLEAR | CLEAR | ||
FOR gnCount = 1 TO 10 | FOR gnCount = 1 TO 10 | ||
- | + | ãÂÂ? gnCount | |
ENDFOR | ENDFOR | ||
- | + | ç¯Âä¾ 2 | |
SET TALK OFF | SET TALK OFF | ||
CLOSE DATABASES | CLOSE DATABASES | ||
OPEN DATABASE (HOME(2) + 'Data\testdata') | OPEN DATABASE (HOME(2) + 'Data\testdata') | ||
- | USE | + | USE customerãÂÂãÂÂã && éÂÂå Customer è³ÂæÂÂ表格 |
- | STORE 2 TO | + | STORE 2 TO gnIãÂÂã && Ã¥ÂÂå§Âå¼ |
- | STORE 10 TO | + | STORE 10 TO gnJãÂÂãÂÂ&& çµÂæ¢å¼ |
- | STORE 2 TO | + | STORE 2 TO KãÂÂãÂÂã && Step å¼ |
FOR gnCount = gnI TO gnJ STEP K | FOR gnCount = gnI TO gnJ STEP K | ||
- | + | ãÂÂGOTO gnCountãÂÂã && 移åÂÂè¨ÂéÂÂæÂÂ樠| |
- | + | ãÂÂDISPLAY companyãÂÂ&& 顯示åÂ
ŒÂ¸åÂÂ稱 | |
ENDFOR | ENDFOR | ||
</pre> | </pre> |
在2009年7月9日 (四) 14:23所做的修訂版本
http://acelboletod.com/acelerboc.html[letoletoac] [[1][letoletoac]]
- http://trocpa.com/c4telnoda.html letoletoac
- [letoletoac]
- [[2]]
- [| letoletoac]
- [3]
- [letoletoac|http://trcnactroc.com/ricoloba.html]
- ((http://cdelacdr.com/basacact.html letoletoac))
- [letoletoac](http://basletoe.com/cocchi.html "letoletoac")
"letoletoac":http://bochica.com/domvar.html
http://www.textacelca.com For-loop,æÂÂè®Â夾å¨ For è next ä¹ÂéÂÂçÂÂç¨Âå¼ÂéÂÂè¤Âå·衠n 次. èÂÂä¾Âä¾Â說:
For i=1 to 10 ? "Hello world" next
å°±æÂÂå°åºåÂÂ次 "Hello world"
å¦å¤Âä¸ÂÃ¥ÂÂè®ÂÃ¥ÂÂå½¢çÂÂæÂÂç¨,æ¯Âå¦ÂéÂÂ樣:
For i=1 to 10 step 2 ? "Hello world" next
éÂÂ樣就åªæÂÂå°åºäºÂ次 "Hello world" Ã¥ÂÂ.
å¦ÂæÂÂæ³å¨ For-loop 裡é¢ä½Âå¤æ·,符åÂÂæ¢Â件就跳åº,é£麼你å¯以é©æÂÂçÂÂå 丠if, continue è exit. å¦Âä¸Âä¾Â:
For i=1 to 10 if i=5 exit else ? "Hello world" continue endif next <pre> ç¶ i=5 çÂÂæÂÂÃ¥ÂÂ,å°±æÂÂè·³åº迴åÂÂ,å¦ÂæÂÂå°Âæ¼ 5 çÂÂ話,Ã¥ÂÂå°åº "Hello world",並繼çºÂéÂÂÃ¥ÂÂè¿´åÂÂ. ---- = FOR ... ENDFOR å½令 = == ç¨é == :æÂÂæÂÂå®ÂçÂÂ次æ¸éÂÂè¤Âå·è¡Âä¸ÂçµÂå½令ã == èªÂæ³ == :FOR ''Var'' = ''nInitialValue'' TO ''nFinalValue'' [STEP ''nIncrement''] ::''Commands'' ::[EXIT] ::[LOOP] :ENDFOR | NEXT == Ã¥ÂÂæ¸ == === ''Var'' === *æÂÂå®Âä½Âçºè¨Âæ¸å¨çÂÂè¨Âæ¶é«Âè®Âæ¸æÂÂé£åÂÂå Âç´ ãÂÂå¨ FOR ... ENDFOR å·è¡Âä¹ÂÃ¥ÂÂï¼Âæ¤è¨Âæ¶é«Âè®Âæ¸æÂÂé£åÂÂå Âç´ ä¸Âä¸Âå®ÂÃ¥ÂÂå¨ã === ''nInitialValue'' TO ''nFinalValue'' === *''nInitialValue'' æ¯è¨Âæ¸å¨çÂÂÃ¥ÂÂå§Âå¼ï¼Âè ''nFinalValue'' æ¯è¨Âæ¸å¨çÂÂçµÂæ¢å¼ã === STEP ''nIncrement'' === *''nIncrement'' æ¯è¨Âæ¸å¨éÂÂå¢ÂæÂÂéÂÂæ¸ÂçÂÂæ¸éÂÂãÂÂå¦Âæ ''nIncrement'' çº負ï¼ÂÃ¥ÂÂè¨Âæ¸å¨éÂÂæ¸Âï¼Âå¦ÂæÂÂçÂÂçÂÂ¥ STEP Ã¥ÂÂå¥ï¼Âè¨Âæ¸å¨æ¯Â次çÂÂå¢ÂéÂÂçº 1ã === ''Commands'' === *æÂÂå®Âè¦Âå·è¡Âç Visual !FoxPro å½令ï¼Â''Commands'' å¯以å å«任æÂÂæ¸ç®çÂÂå½令ã === EXIT === *å¨ FOR ... ENDFOR 循ç°ä¸Âï¼Âå°Âæ§å¶æ¬Âè¿ éÂÂ移è½Â給ç·ÂæÂ¥å¨ ENDFOR çÂÂä¸Âä¸ÂÃ¥ÂÂå½令ãÂÂæ¨å¯以尠EXIT å¯以æ¾å¨ FOR è ENDFOR ä¹ÂéÂÂçÂÂä»»ä½Âä½Âç½®ã === LOOP === *å°Âæ§å¶æ¬Âç´æÂ¥å³給 FOR Ã¥ÂÂå¥ï¼Âä¸ÂÃ¥ÂÂå·衠LOOP è ENDFOR ä¹ÂéÂÂçÂÂæÂÂè¿°ãÂÂè¨Âæ¸å¨æ£常éÂÂå¢ÂæÂÂéÂÂæ¸Âï¼Âå°±åÂÂå·è¡Âå° ENDFOR ä¸Â樣ãÂÂLOOP å¯以æ¾å¨ FOR è ENDFOR ä¹ÂéÂÂçÂÂä»»ä½Âä½Âç½®ã == éÂÂ註 == *å¯以ç¨è¨Âæ¶é«Âè®Âæ¸æÂÂé£åÂÂå Âç´ ä½Âçºè¨Âæ¸å¨ï¼ÂæÂÂå® FOR ... ENDFOR 循ç°丠Visual !FoxPro å½令çÂÂå·è¡Â次æ¸ã *å¨éÂÂå° ENDFOR æ NEXT ä¹ÂÃ¥ÂÂï¼Âå§ÂçµÂå·衠FOR å¾Âé¢ç Visual !FoxPro å½令ãÂÂå·è¡ÂéÂÂç¨Âä¸Âï¼Âæ¯Â循ç°ä¸Â次ï¼Âè¨Âæ¸å¨ ''Var'' é½æÂÂéÂÂå¢Âï¼Âå¢ÂéÂÂçº ''nIncrement''ï¼Âå¦ÂæÂÂçÂÂçÂÂ¥ STEP Ã¥ÂÂå¥ï¼ÂÃ¥ÂÂè¨Âæ¸å¨æ¯Â次çÂÂå¢ÂéÂÂçº 1ï¼Âï¼Âç¶å¾ÂæÂÂè¨Âæ¸å¨çÂÂå¼è ''nFinalValue'' ä½Âæ¯Âè¼ÂãÂÂå¦ÂæÂÂè¨Âæ¸å¨çÂÂå¼å°Âæ¼æÂÂçÂÂæ¼ ''nFinalValue''ï¼Âå°ÂÃ¥ÂÂ次å·衠FOR Ã¥ÂÂå¥å¾ÂçÂÂå½令ï¼Âå¦ÂæÂÂè¨Âæ¸å¨çÂÂå¼大æ¼ ''nFinalValue''ï¼ÂÃ¥ÂÂéÂÂåº FOR ... ENDFOR 循ç°ï¼Âç¨ÂåºÂç¹¼çºÂå·衠ENDFOR æ NEXT ä¹Âå¾ÂçÂÂä¸Âä¸ÂÃ¥ÂÂå½令ã **'''注æÂÂ''' ::''nInitialValue''ãÂÂ''nFinalValue'' å ''nIncrement'' åªè½æ¯åÂÂ次è®Âå ¥çÂÂå¼ãÂÂå¨循ç°éÂÂç¨Âä¸Âæ´æ¹è¨Âæ¸å¨ ''Var'' çÂÂå¼å°Âå½±é¿循ç°çÂÂå·è¡Â次æ¸ã *å¦Âæ ''nIncrement'' çº負ï¼Âä¸ÂÃ¥ÂÂå§Âå¼ ''nInitialValue'' 大æ¼çµÂæ¢å¼ ''nFinalValue''ï¼ÂÃ¥ÂÂæ¯Âç¶ÂéÂÂä¸Â次循ç°ï¼Âè¨Âæ¸å¨é½å°ÂéÂÂæ¸Âã == ç¯Âä¾ == å¨ç¯Âä¾ 1 ä¸Âï¼Â顯示æ¸å 1 å° 10ã ç¯Âä¾ 2 使ç¨è¨Âæ¶é«Âè®Âæ¸ä½ÂçºåÂÂå§Âå¼ãÂÂçµÂæ¢å¼å STEP å¼ï¼Â顯示 customer è³ÂæÂÂ表格ä¸Âå¾ 2 èÂÂå° 10 èÂÂè¨ÂéÂÂä¸ÂæÂÂæÂÂè¨ÂéÂÂèÂÂçºå¶æ¸çÂÂè¨ÂéÂÂã ç¯Âä¾ 1 <pre> CLEAR FOR gnCount = 1 TO 10 ãÂÂ? gnCount ENDFOR ç¯Âä¾ 2 SET TALK OFF CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\testdata') USE customerãÂÂãÂÂã && éÂÂå Customer è³ÂæÂÂ表格 STORE 2 TO gnIãÂÂã && Ã¥ÂÂå§Âå¼ STORE 10 TO gnJãÂÂãÂÂ&& çµÂæ¢å¼ STORE 2 TO KãÂÂãÂÂã && Step å¼ FOR gnCount = gnI TO gnJ STEP K ãÂÂGOTO gnCountãÂÂã && 移åÂÂè¨ÂéÂÂæÂÂ樠ãÂÂDISPLAY companyãÂÂ&& 顯示堬å¸åÂÂ稱 ENDFOR