Results 1 to 4 of 4

Thread: if statement [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    if statement [RESOLVED]

    I was browsing some source code and saw this IF statement:

    VB Code:
    1. If m > n Then n = m
    2.         GetFilename = Mid(Path, n + 1)

    it has no END IF. I didn't know you could omit that part.

    comments?
    Last edited by Andy; Apr 19th, 2004 at 08:53 AM.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    You can IF AND ONLY if the statement to execure upon true value is on the same line. That would be the "n = m" part in this case.
    "GetFilename = Mid(Path, n + 1)" will ALWAYS run, no matter what the result of the IF statement is.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    I can't remember where I've read this, but there may be a bug with using the one line IF statement - memory leak or something. Maybe that's just the compact framework.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    interesting. I don't think I'll start using that but definetely worth knowing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width