PDA

View Full Version : How to use indent to make this style?


youhaodeyi
18th June 2007, 04:04 AM
My code is

if( a == 1){
return 0;
}else{
return -1;
}

I want to use indent to make it to:

if( a == 1 )
{
return 0;
}else
{
return -1;
}

How can I do that?
thanks.

stevea
18th June 2007, 04:49 AM
indent -prs -nsai -bl -bli0 -ce -i0
is pretty close, but it doesn't eliminate the "} else" space.

My question is ... why do you want that sort of 'style'. It's completely unreadable - horrible !

youhaodeyi
18th June 2007, 04:52 AM

There should be some space before each line in if block. But I don't know why these spaces disappeared after i post the reply.

clearer
18th June 2007, 11:22 AM
try encasing your code examples in code tags. Makes formatting easier.

youhaodeyi
19th June 2007, 01:47 AM
How can I encase my code in code tags?