VB写FOR循环,变量有多个区间,怎么将多个区间合并?

2025-05-14 06:08:14
推荐回答(2个)
回答1:

FOR I=1 TO 3
xxxxxx
NEXT
FOR I=6 TO 10
yyyyy
NEXT
合并为:
FOR I=6 TO 10
IF I<=3 THEN xxxxxx
yyyyy
NEXT

回答2:

FOR I=1 TO 10
if i>=1 and i<=3 or i>=6 and i<=10 then
********
********
end if
NEXT