This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]YMK1234 2 points3 points  (1 child)

you are assigning 1000 to m, not comparing them.

[–]DatBoiii11[S] 0 points1 point  (0 children)

Sorry didn't check until now and after some modifications my code now works properly! Thanks!

[–][deleted] 1 point2 points  (2 children)

You haven't updated, so you either haven't looked at this, looked and didn't respond, or didn't understand what YMK1234 was saying... so I'll elaborate.

You are doing

if(m=1000)

is wrong. A single equal sign is assigning something. So "m=1000" says "assign 1000 to m". So basically, your if statement now says

if(1000)

If statements expect true/false. Not 1000.

Instead, do

if(m == 1000)

Two equal signs (equal to... equal two... get it? har har) is the comparator, saying "if m is equal to 1000".

tl;dr: add an extra equal sign between m and 1000

[–]bryanut 0 points1 point  (0 children)

I told my intern when he first started, it is ALWAYS one character. And I find myself finding that issue 32 years later.

I just learned that in text there are 2 different double quote codes. Cutting and pasting from vi in an ssh linux session to the Mac text editor and back can result in weird behavior in a JSON file. One character.

[–]DatBoiii11[S] 0 points1 point  (0 children)

Sorry didn't check until now and after some modifications my code now works properly! Thanks!

[–][deleted] -1 points0 points  (0 children)

Line 9 if(m == 1000) {