Part 2: Using nested if statements and the switch statement.

In an earlier article, I discussed how to use JavaScript to implement the Select From Alternatives program template using different forms of the if statement. In this article, I continue implementing this template using nested if statements and the switch statement. Let’s get started.

Selecting From Alternatives Using a Nested if Statement

Often, selecting from alternatives requires one…

Photo by Shubham Sharan on Unsplash

All runners face difficulties with their running and training. It’s important that you develop tools and strategies for handling these difficulties so they don’t derail you. Here are five tips for dealing with problems that come up while running.

Learn to Recognize When Things are in Your Control and When They are Not

There are lots of day-to-day issues that can cause you to…

Code fundamental C++ constructs using the ROOT C++ interpreter

I learned computer programming in the late 1970s while in college. This meant the first several programming courses I took used programming languages that were mainframe-based: Fortran, PL/I, and Cobol, to mention three.

It wasn’t until after I finished college and started working in the IT industry that I began…

Part 1: Learn how to use the ‘if’ statement.

Most of the computer programs you write need to make decisions based on the data entered into the program. For these situations, there is a program template you can use — Select From Alternatives. There are two JavaScript programming constructs you can use to implement this template — the if

Mike McMillan

Mike McMillan writes about computer programming and running. He is setting up his new web site at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store