GOTO语句

sanji09 2008-09-22 10:41:56
以下代码如果不用GOTO的话,应该怎么改,请高手帮忙看看

Dim giRecord_Count As Integer = 0
Dim index As Integer = 5

A:
giRecord_Count4 = index + 1
GoTo C
B:
If (Me.giRecord_Data(index) = Me.giRecord_Data(giRecord_Count4)) Then
giRecord_Count += 1
End If
giRecord_Count4 += 1
C:
giRecord_Count5 = 9
If (giRecord_Count4 <= giRecord_Count5) Then
GoTo B
End If
index += 1
giRecord_Count5 = 8
If (index <= giRecord_Count5) Then
GoTo A
End If

Return giRecord_Count
...全文
158 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
kimi_yanyz 2008-09-22
  • 打赏
  • 举报
回复
为什么不用sub包起来再去call它呢?
ZengHD 2008-09-22
  • 打赏
  • 举报
回复

可能是错的

Dim giRecord_Count As Integer = 0
Dim index As Integer = 5

While (index <= giRecord_Count5)
giRecord_Count4 = index + 1
giRecord_Count5 = 9
If (giRecord_Count4 <= giRecord_Count5) Then
If (Me.giRecord_Data(index) = Me.giRecord_Data(giRecord_Count4)) Then
giRecord_Count += 1
End If
giRecord_Count4 += 1
End If
index += 1
giRecord_Count5 = 8

End While


Return giRecord_Count

sanji09 2008-09-22
  • 打赏
  • 举报
回复
自己动手,丰衣足食
 giRecord_Count4 = index + 1
giRecord_Count5 = 9
While (giRecord_Count4 <= giRecord_Count5)
If giRecord_Data(index) = giRecord_Data(giRecord_Count4) Then
giRecord_Count += 1
End If
giRecord_Count4 += 1
End While
index += 1
giRecord_Count5 = 8
While index <= giRecord_Count5
giRecord_Count4 = index + 1
giRecord_Count5 = 9
While giRecord_Count4 <= giRecord_Count5
If giRecord_Data(index) = giRecord_Data(giRecord_Count4) Then
giRecord_Count += 1
End If
giRecord_Count4 += 1
End While
index += 1
giRecord_Count5 = 8
End While
Return giRecord_Count
sanji09 2008-09-22
  • 打赏
  • 举报
回复
请大家帮忙改一下

16,717

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧