Showing posts with label Else If. Show all posts
Showing posts with label Else If. Show all posts

All in One

I'm in the middle of creating a program [Java] with the help of two other pals I got in school. We will actually defend that program within this week. We are required to use four out of the five statements, namely:

  • If statement (which includes the Dangling If's and others)
  • Arrays (Whether the normal array or the 2D)
  • Switch (commonly known as Case)
  • Loop (any of the loops)
So array is divided into two which means we have the power to choose which array to use, and that makes it four.

I'll post the code as soon as we are able to merge our codes. Further discussions would be available regarding the program.

IF statement

You have noticed that in the previous post, the first Problem given (and solved) uses the If-else statement.

The If-Else statement can be used for a series of tests on a value. The else part contains only another if statement  If you use if for the else part, it won't easy to see which of the series of tests are identical. Therefore, it is better to write them as If else.


In some cases, programmers use the Dangling If where there are a series of IF's, while some use the else if formatting since it the codes are clearer and readable.

Extended Search

Custom Search
Hello World