Hacker News new | ask | show | jobs
by erik_seaberg 1220 days ago
I try to use line breaks instead, it only took a little getting used to

  for i in $(seq 100)
  do if expr $i % 5 > /dev/null
     then if expr $i % 3 > /dev/null
          then echo $i
          else echo fizz
          fi
     else if expr $i % 3 > /dev/null
          then echo buzz
          else echo fizzbuzz
          fi
     fi
  done
1 comments

I did that at university around 30 years ago. I think nowadays 1TBS is much more common.
Yeah, I use 1TBS and cuddled elses in Scala/Java/C++, but adding a semicolon to do it with a keyword feels like arguing with the grammar.