• Bratek (unregistered)

    Batman() makes perfect sense to me!

  • Phil Winstanley (unregistered)

    Oh No! Inline SQL ! Are you sure an inexperienced maintenance programmer didn't write that?

    ;-)

  • Michal Chaniewski (unregistered)

    I've seen a function named 'sht()' (autocensored) - and there was even a comment:

    // Function does a sh
    t
    private void sh*t()
    {
    [...]
    }

    Sorry, no screenshot :(

  • Mark Petronis (unregistered)

    What is a function?

  • Brock Dodgson (unregistered)

    Good question.

  • Jim Ross (unregistered)

    Well WTF are you doing testing a string for less than -1 when you just found out it is NULL?

    I mean:
    If IsNull(strFileName) Then If Len(strFileName) < -1 Then Exit Function

    Have you ever tested this function with a null string? Or am I having a senior moment here or something? WTF do you expect to happen if strFileName is null?

  • Matthew (unregistered)

    Jim,

    <pedant mode>
    The code is checking the Len against 1 rather than -1.
    </pedant mode>

    Obviously, if strFileName was ever Null () then the Len call will raise error 94 - Invalid Use of Null (since Null does not have a length by definition).

    Note to C programmers if they feel inclined to disagree - VB's Null is different to C's NULL. VB's Null has nothing whatsoever to do with strings (ie VB 6's Null is different to C's idea of a 'null string').

    Seeya
    Matthew

  • Jim Ross (unregistered)

    My point exactly. The purpose of the test is to exit the function gracefully if a null or empty string is passed, or if an empty one is passed. As written, it will not do that, all it will do is throw an error. Great teaching tool. Not.

  • Batman Jr. (unregistered)

    I'm batman().

  • foxyshadis (unregistered)

    My guess is he saw that isnull is a good way to catch a bad input, and he saw that testing for len 0 (or is he expecting a negative string length?) is another good way to catch them... so why not COMBINE them for maximum usefulness and efficiency? Hey, there's an idea! =D

  • Luke (unregistered)

    I also like the way he declares a variable for the name of a table and then doesn't bother using it, genuis!

  • Rick (unregistered)

    $myhtmltemplate = <<< Myubberprogrammerwashere

    (html here)

    Myubberprogrammerwashere;

    Hey, it's perfectly valid HEREDOC format! What's so wrong with it? :P

  • (cs)

    Of course you could also have gone with :

    dim thelights

    etc.

  • (cs) in reply to Springstone

    It's perfectly obvious why this function is named this way. It's so you can write brilliant code like:


    If TheRiddler.HasEscaped Then Call Batman()

    Makes perfect sense to me.


  • Anon Joe (unregistered) in reply to Luke

    Well, actually he does use it, genius!

  • (cs)

    Oh no! I just read that

    Batman = False

    What will happen to Gotham now?

Leave a comment on “Function Batman()”

Log In or post as a guest

Replying to comment #:

« Return to Article