Author Topic: The fastest "else if" in the West  (Read 2720 times)

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
The fastest "else if" in the West
« on: January 26, 2022, 04:27:48 PM »
Did you know you can add an else-if clause in brace-oriented languages with one keypress?

Try this:
Code: [Select]
            if ( condition_one ) {
                // type a close brace on the next (blank) line
                |
            } else {
            }

You will be left with this:
Code: [Select]
            if ( condition_one ) {
                // type a close brace on the next (blank) line
            } else if ( | ) {
            } else {
            }

Did you really want just a close brace?  Easy, hit Undo:
Code: [Select]
            if ( condition_one ) {
                // type a close brace on the next (blank) line
            }
            } else {
            }

Note:  If you do not already have the "else" clause, you will be prompted whether you want to add an "else if" or an "else".