Excel 调用退出函数|递归时出错
我在玩递归并创建这个 ABBB跑得不错,实现吧 巴布跑得很好,去实现吧 BBAB运行正常,实现 BBBA运行不正常,获取false 函数的这一部分可以正常运行,但当调用exit函数时,如果代码的第行出现错误,该行将跳到最后一行。当我用f8键遍历代码时,它来回跳了三次。这几乎就像是在编译x3的if循环,而不是退出函数 好的,这样行。谢谢大家Excel 调用退出函数|递归时出错,excel,vba,Excel,Vba,我在玩递归并创建这个 ABBB跑得不错,实现吧 巴布跑得很好,去实现吧 BBAB运行正常,实现 BBBA运行不正常,获取false 函数的这一部分可以正常运行,但当调用exit函数时,如果代码的第行出现错误,该行将跳到最后一行。当我用f8键遍历代码时,它来回跳了三次。这几乎就像是在编译x3的if循环,而不是退出函数 好的,这样行。谢谢大家 Function practieRecursive(userstring, UserStringIndex) As Boolean UserStrin
Function practieRecursive(userstring, UserStringIndex) As Boolean
UserStringIndex = UserStringIndex + 1
If CInt(UserStringIndex) > Len(userstring) Then
practieRecursive = False
Exit Function
ElseIf Mid(userstring, UserStringIndex, 1) = "A" Then
practieRecursive = True
Debug.Print practieRecursive
Exit Function
Else
practieRecursive = practieRecursive(userstring, UserStringIndex)
Exit Function
End If
Debug.Print practieRecursive
End Function
在检查
CInt(UserStringIndex)=Len(userstring)
之前,您正在尝试Mid(UserStringIndex,1)=“A”
。重新安排你的支票
Function practieRecursive(userstring, UserStringIndex) As Boolean
UserStringIndex = UserStringIndex + 1
If CInt(UserStringIndex) = Len(userstring) Then
practieRecursive = False
Exit Function
elseIf Mid(userstring, UserStringIndex, 1) = "A" Then
Stop
practieRecursive = True
Exit Function
Else
Call practieRecursive(userstring, UserStringIndex)
End If
End Function
在检查
CInt(UserStringIndex)=Len(userstring)
之前,您正在尝试Mid(UserStringIndex,1)=“A”
。重新安排你的支票
Function practieRecursive(userstring, UserStringIndex) As Boolean
UserStringIndex = UserStringIndex + 1
If CInt(UserStringIndex) = Len(userstring) Then
practieRecursive = False
Exit Function
elseIf Mid(userstring, UserStringIndex, 1) = "A" Then
Stop
practieRecursive = True
Exit Function
Else
Call practieRecursive(userstring, UserStringIndex)
End If
End Function
调出调用堆栈调试器工具窗口。您将看到
Exit函数
仅弹出最顶层的堆栈帧-您需要退出每个被推送的堆栈帧-行为完全正常。怎么了?你是对的,我今晚会处理这个。感谢您打开调用堆栈调试器工具窗口。您将看到Exit函数
仅弹出最顶层的堆栈帧-您需要退出每个被推送的堆栈帧-行为完全正常。怎么了?你是对的,我今晚会处理这个。感谢您将从=切换到>或丢失最后一个字符。不过,这样效果更好,更干净。仍然有问题,请参阅OPGood catch on
vs=
中的文本!我将再看一看op。我在看我的原始代码时捕捉到它,这是导致错误LOL和re的原因。另一个look必须从=切换到a>,否则将丢失最后一个字符。不过,这样效果更好,更干净。仍然有问题,请参阅OPGood catch on
vs=
中的文本!我会再看一眼这个操作。我在看我的原始代码时发现了它,这是给你带来错误的地方。哈哈,再看一眼