Let's say that I have :
Code: Select all
Select Case Right(sString, 1)
Case "1" : <do stuff>
Case "2" : <do stuff>
Case "3" : <do stuff>
Case "4" : <do stuff>
End SelectAssuming that "Right(sString, 1)" equals 5, will the VBS Engine evaluate "Right(sString, 1)", check if the result is 1, then "go back to the top" so to speak and evaluate Right(sString, 1) again, check if the result is 2, then evaluate it again before checking if it's 3, etc etc ?
Or will it instead evaluate "Right(sString, 1)" once and for all, "remember" the result, and match it against the cases ?
If it was for any other Sub, I'd just Dim a variable, put the result of "Right(sString, 1)" in it, and make the match against the variable instead, but since it's for DataArival, I thought it was worth trying to get it as performant as possible.
If no one knows, it's probably what I'll do anyway, but I thought I'd ask first... Anything to save a few CPU cycles and bytes of memory =p
(and no, in my actual script, I'm not matching anything against the first character from the right of a string in DataArival, it was just to keep the question as simple as possible =)