Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return 2 values from a function
Message
From
17/10/2008 10:29:43
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
17/10/2008 10:16:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01355203
Message ID:
01355589
Views:
36
>>I think Hugo got his code exactly right as it couldn't have returned anything but False so why bother with all the extra code.
>
>Please recheck the codes. You got the code wrong too.
>They are too much different making me to think multiple returns or single return doesn't do any contribution to readability and maintainability;)
>
>
>Cetin

Well that could be so lets review.
>>Function SomeMethod() AS Boolean
>>
>>   Dim result as Boolean = False
"result" starts out false here
>>
>>   If FirstCheck() = False Then
>>      result = False
then if FirstCheck() is true, nothing happens but if it is false, "result" is still false

>>   ElseIf SecondCheck() = False Then
>>      result = False
>>    Else
>>        'Other code here
>>   EndIf

now if SecondCheck() is true, no change to "result" but if it is false, then "result" is still false.  No indication what Else does.
>>
>>   Return result
Here we might as well just return false.
>>      
>>End Function
>>
What did I get wrong?
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform