+ 2

Why doesnt my "IF" statement work

I'm writing a code to give a scientific notation of a number and I noticed the if statement isn't doing what it said https://code.sololearn.com/Wo6qbx2iPIpW/?ref=app https://code.sololearn.com/Wo6qbx2iPIpW/?ref=app

30th Jun 2019, 11:31 AM
Michael Okolie
Michael Okolie - avatar
12 Réponses
+ 3
Your program will evaluate input/10 but won't know what to do with this number. You need to set input equal to this value or it will just be ignored. Eg. input = input/10
30th Jun 2019, 9:35 PM
Frenchtoast
Frenchtoast - avatar
+ 5
The statement input / 10; doesn't do anything, you probably want to use input /= 10 (same with input * 10)
30th Jun 2019, 11:38 AM
Anna
Anna - avatar
+ 4
It doesn't. Unless you use something like return input / 10. A single statement "input / 10" will never have any effect
1st Jul 2019, 8:52 PM
Anna
Anna - avatar
+ 3
but why
30th Jun 2019, 2:05 PM
Michael Okolie
Michael Okolie - avatar
+ 3
Michael Okolie You mean the x+=1?
1st Jul 2019, 3:26 AM
Frenchtoast
Frenchtoast - avatar
+ 2
but it works in functions
30th Jun 2019, 9:49 PM
Michael Okolie
Michael Okolie - avatar
+ 1
Remember Javascript is case sensitive
7th Jul 2019, 12:28 AM
David Bodunde
David Bodunde - avatar
0
Frenchtoast No the "If" statement
1st Jul 2019, 4:24 PM
Michael Okolie
Michael Okolie - avatar
0
Michael Okolie I am confused as to what you are asking? "If" statements work in functions.
1st Jul 2019, 5:57 PM
Frenchtoast
Frenchtoast - avatar
0
am saying that " input / 10" didn't work in my if statement but it works in functions Frenchtoast
1st Jul 2019, 8:51 PM
Michael Okolie
Michael Okolie - avatar
0
Give me an example please.
1st Jul 2019, 9:10 PM
Frenchtoast
Frenchtoast - avatar
0
use "if" not "IF"..case sensitive
8th Aug 2019, 5:57 PM
Zee Khan
Zee Khan - avatar