Hi, I have a code which is redundant. Sp please help me in optimizing the code.
Basically I am feting a fetching a version number from registry. It can be in any of one of 6 path. So I am iterating like below code. I feel there can be something better than this. Please help me to optimize the below code.
Private Function as Integer()
'Some Code
versionnum = GetRegValue (hKey,path1,"Version","")
If versionnum = "" Then
versionnum = GetRegValue (hKey,path2,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path3,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path4,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path5,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path6,"Version","")
EndIf
returnval = CompareVersion(Expected,versionnum)
'Some Code
End Function
Basically I am feting a fetching a version number from registry. It can be in any of one of 6 path. So I am iterating like below code. I feel there can be something better than this. Please help me to optimize the below code.
Private Function as Integer()
'Some Code
versionnum = GetRegValue (hKey,path1,"Version","")
If versionnum = "" Then
versionnum = GetRegValue (hKey,path2,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path3,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path4,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path5,"Version","")
EndIf
If versionnum = "" Then
versionnum = GetRegValue (hKey,path6,"Version","")
EndIf
returnval = CompareVersion(Expected,versionnum)
'Some Code
End Function