Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return 2 values from a function
Message
De
17/10/2008 10:50:43
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
17/10/2008 10:37:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01355203
Message ID:
01355598
Vues:
31
>You know my code with multiple returns was like this:
>
>
public bool SomeMethod()
>{
>  if ( FirstCheck() = false ) { return false; }
>  //...
>}
>
>I copied Hugo's
>
Function SomeMethod() as Boolean
>  return false
>endfunc
>
>And you know the other one written in VB
>
>Hugo's code immediately return "false" w/o doing anything right?
>
>Other codes (mine and Mike's) at least make a call to FirstCheck(). FirstCheck() might be doing tons of things before returning false.
>
>Cetin


Ok, the whole discussion was on return values and this is exactly why I intended to stay out of this. Too bad I didn't do that. So a better example of comparrison should have been.
public void SomeMethod()
{
     // Do something nobody knows the results of
     bool worthlessValue = FirstCheck();
}
My intended point was Hugo got it right in that if you are going to return something it might as well have a valid value. And his post had a (bg) on it so I took it he knew exactly what he was saying. His point was right in my book. As I said, I am not judging you or anyone else for your programming methods and I don't by any means consider mine to be "All Correct". There wouldn't be much use in this forum if there wasn't something to gain from everyone else and good discussions.
Tim
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform