+ 1

If else

Hello everyone! Question: what's wrong with this? Var record = 2.45 Var newrecord = 2.49 If (newrecord > record) { Console.log("new record") } else { Console.log("not thid time") } If I do it on the PC, it works well but I still do it here in the app, it gives an error and I don't understand why.

18th Sep 2022, 4:10 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
29 Answers
+ 3
var record = 2.45 var newrecord = 2.49 if (newrecord > record) { console.log("new record") } else { console.log("not this time") } //Pay attention on the characters used
18th Sep 2022, 4:13 PM
Random
Random - avatar
+ 2
Correct spelling of "var" and "if" statements. You wrote "Var" and "If" instead.
18th Sep 2022, 5:17 PM
Emerson Prado
Emerson Prado - avatar
+ 2
when you write your code in the problem solving window, before you pass the tests, do you have these lines? var height = parseFloat(readLine(), 10) //Your code goes here
21st Sep 2022, 2:01 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
And Console.log 👆 👉 console.log
18th Sep 2022, 5:18 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
No! No! Excuse me guys!! The code is written all in lowercase, in the question if it is in uppercase but not in the app, all in lowercase. I think it's something that Yaroslav Vernigora comments
18th Sep 2022, 8:24 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
+ 1
leave the input variable alone, it is called "height" and it has already been created in you, if you did not delete it before. if you are confused about what to do, then copy the entire code and show it here and we will analyze its work together
19th Sep 2022, 11:58 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
very well, and now delete the second extra variable height in your code. you see, it has already been created above without your participation. just let her be there and thats it. and delete your variable. she is superfluous here
19th Sep 2022, 2:12 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
conduct a personal investigation and find out what this top line of code is doing: --- >>> parseFloat(redLine(), 10)
19th Sep 2022, 2:14 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Alguien que me de una mano? Sigo sin entender porque da error el codigo!!! Someone to give me a hand? I still don't understand why the code makes a mistake!!!
20th Sep 2022, 5:44 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
+ 1
te di pistas e incluso te indiqué claramente qué hacer. ¿o decidiste ir por el camino simple?
20th Sep 2022, 7:09 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
show your final version of the code
21st Sep 2022, 5:30 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Yes. The parsefloat converts a string to float (decimal) what I don't understand is the "readline(), 10"
21st Sep 2022, 3:31 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
+ 1
wonderful! this was dealt with. now understand one simple thing in sololearn coding tasks. in some cases, you are asked only to supplement and complete the already started program. in this case, you have already written input data for you and created a variable "height". this variable will automatically change without your participation five times to pass the tests. why do you create it again and assign it a rigidly specific value??? let her go. let her live on her own. your second same variable "height" is superfluous. just remove it. it is not needed!!!
21st Sep 2022, 4:14 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Yaroslav Vernigora For God's sake!! That #@€%#¥€%# that I am!! How easy it was!! Thank you very much for your patience, thank you so much more for taking the time to help me and a thousand thanks for the vibe!! I send you a big hug from Argentina!!
21st Sep 2022, 5:44 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
+ 1
🤣👆 thats what Ive been trying to tell you for two days. wind up and read my messages again. for some reason you did not notice them. greetings to you from Russia and waiting for an invitation to Argentina as a guest 😁😉
21st Sep 2022, 6:15 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Yaroslav Vernigora Jajaja!!!' It's just that I didn't quite understand what you meant. People like you are always invited. My house is very small but always open to people like you. If you come to these places, let me know that I'm sure we'll see each other and have a few drinks.
21st Sep 2022, 7:58 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
0
I don't understand. I inserted your code and it keeps getting bad. The input value has to give me 2.49 and it comes out 2.41
18th Sep 2022, 4:52 PM
Marcelo Ferreyra
Marcelo Ferreyra - avatar
0
Hi! you supplement the code with an already started but not finished program, where the first line of code already has a variable "height", that will change randomly five times to get you through five tests, so: 1. remove(delete) the line with the "newrecord" from the code that you were prompted above, 2. compare the "record" with the variable "height" in the expression --->>> if 3. and correct the error in the phrase: "not thid time" --->>> "not this time"
18th Sep 2022, 5:13 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar