Sharpe's Opinion

Sunday, 14th Dec, 2008

Comments

  1. December 14th, 2008 | 5:44 pm

    Wow. I, sir, salute you.

  2. April 14th, 2009 | 2:41 pm

    Hmm. Will this descend into a sort of “how many languages can we write this in?” fest? I’ll see your Ruby and raise you a Perl.

    #!/usr/bin/perl -w use strict; sub yn { $_ = shift; print; $_ = ; /y/i }; if ((yn "Do you have a problem? (y/n): ") && (!yn "Can anyone else help? (y/n): ") && (yn "Can you find them? (y/n): ")) {print "Maybe you can hire… the A-Team!\n";} else {print "You Cannot Hire the A-Team.\n"};

  3. April 14th, 2009 | 2:48 pm

    Gick. It got mangled by the formatter! You need a line break after the first line.

    And thinking about it, maybe I should have put the (y/n): within the function. And made that regular expression /[yj]/i for compatibility with German-speakers. Or /[yjos]/i for compatibility with German, French and Spanish-speakers.

    Nah, s*d it ….. I can always put some of those features into the next release. And if I can’t think of anything to add to the next-plus-one release, then I’ll just hold something back from the next one.

  4. April 14th, 2009 | 2:53 pm

    Javascript version is slightly fudgy:

    if (confirm(“Do You Have A Problem?”) && !confirm(“Can Anyone Else Help?”) && confirm(“Can You Find Them?”)) {
    alert(“Maybe You Can Hire… The A-Team”);
    }
    else alert(“You Cannot Hire The A-Team”);

    The issue is that ‘Confirm’ gives you a choice of ‘OK’ or ‘Cancel’ rather than ‘yes’ or ‘no’

  5. April 14th, 2009 | 3:15 pm

    …And just to demonstrate the inadequacies of AppleScript…

Leave A Comment

Comment Form

Preview: