Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: What would you say is the most-used way of indenting case labels



On Fri, Aug 11, 2006 at 08:37:41PM +0100, Peter Stephenson wrote:
> Time for some audience participation.  Do you prefer the following
> style? [...]

I like the case labels to be less indented than the code that follows.
I personally put them at the same level as the case, and only include a
statement on the same line if all the labels are really short and the
commands a one-liner, so in the general case I'd separate them:

foo () {
    case $1 in
    (a)
        print alpha
        print second
        print third
        ;;
    (b)
        print beta
        ;;
    (*)
        print omega
        ;;
    esac
}

I also like a 4-character indent.  That's my preference...

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author