Ask HN: Your favorite syntactic sugar from any language?
Most programming languages I've encountered, no matter how otherwise unappealing, have at least one syntactic feature that makes them really pleasurable for at least some type of task.
Some things I miss when I don't have them are:
* "=~" for regex matching (as in Perl and Ruby)
* "{foo:['bar','baz']}" for quick data structures (as in JavaScript)
* "for f in *; do echo $f; done" for looping over a 'glob' of files (as in Bash)
Some things I miss when I don't have them are:
* "=~" for regex matching (as in Perl and Ruby)
* "{foo:['bar','baz']}" for quick data structures (as in JavaScript)
* "for f in *; do echo $f; done" for looping over a 'glob' of files (as in Bash)
What's your favorite bit of sugar?