Alex
Alex

Reputation: 9265

netbeans blank line after if statement

In netbeans how can one format it so that after if-blocks there is a blank line? I have been searching through the formatting options and trying different things to no avail.

e.g.

if ($lifegivesyoulemons) {
   echo "say f' it and bail";
}

if ($if_they_take_my_stapler) {
   echo "i will set the building on fire";
}

Upvotes: 1

Views: 480

Answers (1)

Shashanth
Shashanth

Reputation: 5190

Not specifically for if-else loop this should work for all methods also.

In your Netbeans IDE goto Tools - then select Editor tab.

Under Editor tab select Formatting select language PHP (as per your if-else loop in question) and Category Blank Lines

Netbeans screen-shot 1

And then scroll down in After Function field change value 0 to 1 like this

Netbeans screen-shot 2

Click on Apply and Ok

Now select On Save tab. Select language PHP

Netbeans screen-shot 3

Uncheck Use all language settings. After that from drop down select All Lines. Click on Ok

Now you type code hit Ctrl + S Netbeans automatically formats your code with one blank line after } brace (bracket). (As of I know this should work both methods and loops also).

Upvotes: 1

Related Questions