Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if stmt

Status
Not open for further replies.

rds747

Technical User
Mar 8, 2005
180
US
Simple question..

The if stmt is
Code:
If (lngAffected < 1) then
 Msgbox "Record does not exist"
 Exit Function
End If
[\code]

How do I change the if stmt so it's:
[code]
if (lngAffected < 1) then Msgbox "Record does not exist" Exit Function
[\code]

Thanks.
 
Code:
if (lngAffected < 1) then Msgbox "Record does not exist": Exit Function
But why bother?
 
Code:
if (lngAffected < 1) then[COLOR=red][b]:[/b][/color] Msgbox "Record does not exist"[COLOR=red][b]:[/b][/color] Exit Function
 
Get new management -- the current one is an idiot and doesn't realize that multiple statements on a single line make software maintenance harder (i.e. more expensive).

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Golom, you don't need the first colon

rds747, I suspected it might be an uninformed diktat (which is why I posed the question). And I have to agree with chiph's response

Note that at the compiler level, both statements are completely syntactically similar and will almost certainly generate the same code - so there's no performance gain in either speed or code size to weigh up against the reduction in legibility and clarity
 
Sounds like someone went from second year college programming to sales to management.....at least, this is a fairly reliable "uninformed diktat" recipe.

So, yup, I think he's an idiot too.
 
He's actually very smart. Is quick with his logic and common sense. Maybe doesn't follow the norm in programming, but...
 
If he was smart, he'd let his programmers do the programming, and not try to dictate how they do their work.
 
<He's actually very smart.

Well, we don't mean idiot in the sense of having a low IQ. Perhaps "pig-headed" better describes what we're trying to convey. (Personally, I particularly like "uninformed diktat".)

<Is quick with his logic and common sense.

Well, demanding that your reports eschew best practices in the name of less-maintainable code doesn't seem to show a whit of common sense, although it probably does indeed require a gifted logician to successfully argue the point of view.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top