We worked on else/ifs today. I think else ifs are really easy. It goes like this:If the first condition isn't true, do the next thing if the next condition is true. If it's not, then go to the next. It's really very simple. Let's say x is 2.
if(x==3) {
out.print("Hello!"); }
else if(x==1) {
out.print("Goodbye!"); }
else if(x==2) {
out.print("Howdy!"); }
The output would be
Howdy!
Like I said, pretty easy. I am definitely very comfortable with this.
No comments:
Post a Comment