看板 Visual_Basic 關於我們 聯絡資訊
C 語言的continue 是可以指令重新執行for迴圈, 請問VB有哪個語法有continue的功能? EX: for i = 0 to 10 List1.AddItem = i if i = 5 then ??? next i 我想要不把5這個函數印在list1上,請問怎麼用? -- 學習感想:http://ppt.cc/94uu 學習態度:http://ppt.cc/NQrD 心得: 詐欺遊戲:http://ppt.cc/39P- 解殘局:http://ppt.cc/FpGm 那些年:http://ppt.cc/1JuM 中二病:http://ppt.cc/OM-S 少年Pi:http://ppt.cc/NJh8 鬥棋:http://ppt.cc/WPqF -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.121.200.43
DeathWatch:迴圈外寫 nextFor: Next i 05/27 20:43
DeathWatch:if i = 5 then goto nextFor 05/27 20:43
tsongs:if i <> 5 then : List1.AddItem = i : Endif '這樣也可 05/27 20:56
DeathWatch:樓上好棒 05/27 21:30
chinagogoya:了解了,也就是沒continue用法。 05/27 21:47
for(i=0;i<=10;i++) { if(i==5) continue; [statement] } C語言是這樣寫的,看來VB是沒continue,感謝講解。 ※ 編輯: chinagogoya 來自: 140.121.200.43 (05/27 21:49)
fumizuki:VB.NET才有continue 05/27 23:47
DeathWatch:java也有 05/28 00:31
chinoyan:三樓那個 : Endif ,不加也可以吧 05/28 05:16
MOONRAKER:單行if少用,因為你不知道將來會不會加新東西進去。 05/28 09:04
tsongs:那是因為推文想一行寫完 05/28 16:35
chinoyan:單行IF,沒END IF,在IDE有自動縮排的情況,不會忘了加回去 05/29 06:12
chinoyan:所以沒差,如果CODE縮排沒有,就可能會出問題 05/29 06:12
tsongs:如果多個用Select case比較方便 05/29 10:15
tsongs:select case i 05/29 10:16
tsongs:case 1,3,5 '1,3,5 不要 05/29 10:18
tsongs:case else : List1.AddItem = i '其他要的寫進去 05/29 10:18
tsongs:end select 05/29 10:19