Select Page

Print a multiplication table with 6 with `for-loop` .

Expected result:

## Explanation

The row of six goes from 6 to 60. Therefore we need a `for-loop `that iterates 10 times. You are a bit familiar with loops now (since you made challenge #01 and #02) and you know the rules of a` for-loop`.

The variable `row` is our printed statement every iteration. To get the multiplication table of six, we just multiply the base number of 6 with the next value of the iteration process. The row of six starts with 6*1, then 6*2, and then 6*3, and so on…

To print now a decent table, we have to display the entire entry as a term. So `6 * 1 = 6` as code is `"6 * " + i + " = " 6 * i` We need to have the quotation marks here, because we want a string as result. If we don’t use the quotation marks the “compiler” would then complain about the `=` . Leaving out also the = and the `+` sign in front of it would result in the following line:

``let row = 6 *  + i + 6 * i;``

Running the program then will print this:

We have created a completely different term and therefore also a completely different output.

Be sure, that you know what you want to accomplish in order to use the right data types and statements.

Follow me on Instagram and don’t miss the latest Challenge!

https://www.instagram.com/arnold.code/

## Are you interested in Object-Oriented Programming Languages?

Here is a top and high quality Medium article for you.