#Issue with generating isosceles
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
As the script should do: Ask the question, then i wanna get the result of the question in numbers, then acess the int, make the isosceles based on that number, then return the print
i tried also to transform the generator to a void, but still have issues
Why question.length()?
Also pls pass to camelCase.
BallsCase, or however it's called, is standardised to classes.
I dont remember on how to get the int of the question
Done.
Integer.parseInt().
And remember to use a try-catch.
Use Internet if you don't rmemeber snth
Smth
Use try-catch in case the user inputs unallowed chars
And again, not question.length() as parameter
Yeah but in general if i do return the numofstars, and the string of the int is the number, then why it doesnt print the isosceles?
You gotta be careful. It's a chain reaction. Change 1 thing, change all references
yeah, that is basically the length of the messaaage
As like i tried rn to run it, and it prints "1"
and not the generator
Because you haven't fixed the question.lrngth thing
OPS
Read it all
Why have you placed numOfStars outside the for loop? Thats odd.
Could've done for(int numOfStars = 0; ...)
Ahh you return it after
Straight up pass to a while loop. Cleaner.
Also show what you get.
The number you pass to the function is a actually the number of rows of your output, if you look carefully.
Did manage to debug it by myself, but now i have 2 things, it returns number 3, and without a return it wont let me run the code, and second error, the spaces are not applying :/
Ofc it prints 3
You are returning the number 3 and printing it in main
Yeah.. which if i do remove the number, it wont let me run with return.
What spaces? Println() correctly places a space AND goes down. BUT at the end of the inner loop. So the soace isn't visible
Of course. You must pass to void return type of the func
And remove the call from the argument of IO.println
I think i mess it up so badly, as it should had spaces and be a triangle like this:
**
***```
Rethink of it for 3 mins.
so i should transform the entire generator into void?
Which wont allow me to print the result
- void returns no type - IO.println doesn't accept void.
- what are you expecting to print? isoscelesGenerator already is printing.
- No need of a return statement in a void function, unless doing early-return.
I gave ya all the answers.
Answer a few questions for me
How many letters are in the word Apple?
4
It's fine if you can't print the result, because the function itself has the job of printing
When you call it it will print it doesn't need to return anything necessarily
I did debug it and sadly still have issues
Swap lines 10 and 11
Oh my, thanks!
Yeah i got so dizzy
i didn't realize the print was outside of the loop
train ur concentration
What does that mean
I already getting better and better, but everyone does mistakes
he needs to learn to read code
He means to double, triple check my codes, even if my mind is pretty dizzy and forget stuff like this
Your mind being dizzy sounds like a symptom of a disease, but okay
you forget because you dont know to read code yet. programming is almost learning a foreign language. need the grammar, but also need practice to get the right eye pattern
u'll learn
No no, like i fell i get pretty lost, as i started to learn allot of stuff in js a few days. As this stuff i supposed to learn, it should had been days of training.
Currently fixed the printing and everything, now this return eats me 😭
That's right, i just need enough time to keep practice
Honestly idk, as idk what i suppose to return in this scenario.
The number? the rows?
In general just the pattern
Then how il fix the line 17?
remove io.println
And you fixed my life
Yeah, so in general i didn't understood the concept of return and forgot how to do isosceles 😭
Oh
Yeah idk why i even used return at this point
felt useles in this.
useless*