+ 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.
29 Respostas
+ 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
+ 2
Correct spelling of "var" and "if" statements. You wrote "Var" and "If" instead.
+ 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
+ 1
And Console.log 👆 👉 console.log
+ 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
+ 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
+ 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
+ 1
conduct a personal investigation and find out what this top line of code is doing:
--- >>> parseFloat(redLine(), 10)
+ 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!!!
+ 1
te di pistas e incluso te indiqué claramente qué hacer. ¿o decidiste ir por el camino simple?
+ 1
show your final version of the code
+ 1
Yes. The parsefloat converts a string to float (decimal)
what I don't understand is the "readline(), 10"
+ 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!!!
+ 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!!
+ 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 😁😉
+ 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.
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
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"