对计算结果重复运算
增加一个自定义函数,名称为hd,代码为:
Dim d As String = Args(0)
Dim d1 As String
For i As Integer = 0 To d.Length - 1
d1 = val(d1) + val(d(i)) ^ 3
Next
Return d1
命令窗口执行下面代码:得到数字3及其倍数的“黑洞”,结果为:153
Dim d As String = 3
Dim T As String
If d = Functions.Execute("hd",(d)) Then
T = Functions.Execute("hd",(d))
ElseIf Functions.Execute("hd",(d)) = Functions.Execute("hd", _
(Functions.Execute("hd",(d)))) Then
T = Functions.Execute("hd",(Functions.Execute("hd",(d))))
ElseIf Functions.Execute("hd",(Functions.Execute("hd",(d)))) = _
Functions.Execute("hd",(Functions.Execute("hd",(Functions.Execute("hd",(d)))))) Then
T = Functions.Execute("hd",(Functions.Execute("hd",(Functions.Execute("hd",(d))))))
ElseIf Functions.Execute("hd",(Functions.Execute("hd",(Functions.Execute("hd",(d)))))) = _
Functions.Execute("hd",(Functions.Execute("hd",(Functions.Execute("hd", _
(Functions.Execute("hd",(d)))))))) Then
T = Functions.Execute("hd",(Functions.Execute("hd",(Functions.Execute("hd",(Functions. _
Execute("hd",(d))))))))
'…… 执行100次,还是不符合条件,终止执行
End If
output.show(T)
按照上面的规律,请问自定义函数如何设置?