Click here to Skip to main content
15,892,746 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Custom PaperSize Problem Pin
AmirAlilou5-May-07 1:05
AmirAlilou5-May-07 1:05 
AnswerRe: Custom PaperSize Problem Pin
P P Vilsad6-May-07 5:34
P P Vilsad6-May-07 5:34 
GeneralRe: Custom PaperSize Problem Pin
AmirAlilou6-May-07 21:15
AmirAlilou6-May-07 21:15 
GeneralRe: Custom PaperSize Problem Pin
P P Vilsad7-May-07 3:03
P P Vilsad7-May-07 3:03 
QuestionIs Multiple Exit points in a method wrong [modified] Pin
RichardBerry4-May-07 21:46
RichardBerry4-May-07 21:46 
AnswerRe: Is Multiple Exit points in a meethod wrong Pin
Xandip4-May-07 22:59
Xandip4-May-07 22:59 
GeneralRe: Is Multiple Exit points in a meethod wrong Pin
RichardBerry4-May-07 23:16
RichardBerry4-May-07 23:16 
AnswerRe: Is Multiple Exit points in a method wrong Pin
Kevin McFarlane5-May-07 3:52
Kevin McFarlane5-May-07 3:52 
RichardBerry wrote:
1) Someone told me a function should have only one exit point - why is this?


It is an ideal but I think most developers are not religious about it. The main reason is maintainability, especially with longer, more elaborate functions. OTOH, in OO code, and in procedural code for that matter, functions should not be too long.

For the example you supply it doesn't matter much. Though it is more concise to write

Return intInput > 10

RichardBerry wrote:
2) Is it bad practice to use the input to the function directly. In example below, I compare intInput to a constant (10). Should I first equate intInput to a local variable and then use a local variable in the comparison. Just seems like extra code to use anothe variable?


No, it's not bad practice if all you're doing is effectively "reading" the input variable, as in your example. It is bad practice to modify the input variable and use the modification for subsequent processing. In this case you should take a copy.

RichardBerry wrote:
3) As opposed to using 'Return True' or 'Return False' is it better to
use the function name - E.g. 'Test = False'


This is VB .NET right? Using Return is the recommended way. Using the function name is retained only for backward compatibility.




Kevin

AnswerRe: Is Multiple Exit points in a method wrong Pin
Dave Kreskowiak5-May-07 3:57
mveDave Kreskowiak5-May-07 3:57 
GeneralRe: Is Multiple Exit points in a method wrong Pin
Paul Conrad5-May-07 5:18
professionalPaul Conrad5-May-07 5:18 
GeneralRe: Is Multiple Exit points in a method wrong Pin
Kevin McFarlane5-May-07 12:18
Kevin McFarlane5-May-07 12:18 
GeneralRe: Is Multiple Exit points in a method wrong Pin
Paul Conrad5-May-07 12:29
professionalPaul Conrad5-May-07 12:29 
GeneralRe: Is Multiple Exit points in a method wrong Pin
RichardBerry6-May-07 23:56
RichardBerry6-May-07 23:56 
GeneralRe: Is Multiple Exit points in a method wrong Pin
Dave Kreskowiak7-May-07 1:16
mveDave Kreskowiak7-May-07 1:16 
QuestionTiff Image Pin
Ramuv4-May-07 21:44
Ramuv4-May-07 21:44 
Questionshortcut key Pin
Sonia Gupta4-May-07 20:48
Sonia Gupta4-May-07 20:48 
AnswerRe: shortcut key Pin
Rupesh Kumar Swami4-May-07 21:52
Rupesh Kumar Swami4-May-07 21:52 
QuestionRe: shortcut key Pin
Sonia Gupta4-May-07 22:32
Sonia Gupta4-May-07 22:32 
AnswerRe: shortcut key [modified] Pin
Rupesh Kumar Swami4-May-07 23:35
Rupesh Kumar Swami4-May-07 23:35 
GeneralRe: shortcut key Pin
Sonia Gupta5-May-07 0:52
Sonia Gupta5-May-07 0:52 
Questionimmediate window Pin
Sonia Gupta4-May-07 20:38
Sonia Gupta4-May-07 20:38 
AnswerRe: immediate window Pin
Xandip4-May-07 22:32
Xandip4-May-07 22:32 
QuestionRe: immediate window Pin
Sonia Gupta4-May-07 22:34
Sonia Gupta4-May-07 22:34 
AnswerRe: immediate window Pin
Xandip4-May-07 22:41
Xandip4-May-07 22:41 
AnswerRe: immediate window Pin
Dave Kreskowiak5-May-07 3:46
mveDave Kreskowiak5-May-07 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.