Hi,

> That's all well enough, but I'm having trouble seeing how to 
> use this eye pleasing space saver to handle something like this:
> 
> If x = 5 then
>     y = 10
> else
>     whatever
> end if

What I am about to show you is not good coding but it works:

    y = -10 * (x = 5)
    If y = 0 Then
        MsgBox "else condition fired"
    End If


The first line takes advantage of the fact that VB evaluates "True" as -1.

This is bad programming, because the next programmer who comes along and
reads it will be scratching their head all day trying to figure out what it
does or why it was written that way.

That said, there are times when such shortcuts are necessary in embedded
languages (like SQL) where it might not be optimal or even possible to
spread the logic over more than one statement.

In VB there is no excuse.

Adelle.



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to