News for hackers. Stuff that matters.
Re:Ask HN: What language do you think in? by byoung2 on Thursday September 03, 2009 @12:25PM (#802803)
For example, if someone asked me to do the fizzbuzz test (http://www.codinghorror.com/blog/archives/000781.html), I might think to myself in pseudocode:

  Loop from 1-100:
    if the current number is a multiple of 3, print "fizz"
    if the current number is a multiple of 5, print "buzz"
    otherwise, print the number
    print newline
Then I might turn that into PHP:

  <?php
    for($i=1;$i<=100;$i++) {
      if($i % 3 == 0) {echo("Fizz");}
      if($i % 5 == 0) {echo("Buzz");}
      if($i % 3 != 0 && $i % 5 != 0) {echo($i);}
      echo("<br />");
    }
  ?>

There are no comments on this comment yet.