reader.readLine() not working as expected
I have a sentences.txt with 60 lines of text.
I wanted it to print something along the lines of:
<div class="text" style="top: [THIS STARTS FROM 5 AND INCREMENTS BY 5, AND FOR EACH THREE INCREMENTS, THE INCREMENT DECREASES BY 1]ex;">[SENTENCE GOES HERE] [HOW MANY TIMES THIS HAS RUN GOES HERE]</div>
As an example, the first few lines should show:
<div class="text" style="top: 5ex;"> Lorem ipsum... 1</div>
<div class="text" style="top: 10ex;"> dolor sit amet... 2</div>
<div class="text" style="top: 15ex;"> adipscicing ameold.. 3</div>
<div class="text" style="top: 19ex;"> molor alor... 4</div>
...
<div class="text" style="top: ??ex;"> blablabla... ?<60</div>
To my confusion, the result looks like:
...
<div class="text" style="top: 2694ex;">Curabitur rutrum... 899</div>
<div class="text" style="top: 2695ex;">Curabitur rutrum... 900</div>
Not only did reader.readLine() seem to read the same line (not shown, but it does this every 16~ times), and the top:??ex and number at the end seems to vastly exceed what I thought should have resulted from the for loop
4 Replies
⌛
This post has been reserved for your question.
Hey @2ndchar! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
So... For each line you read, you do an additional for() that contains an additional for()
Ringing a bell?
uhh are you saying that i dont need two for loops?
oh wait is it because of the while loop, whenever the for loops end, it runs again because of the while loop?
wait i think thats it actually
thx for that
Post Closed
This post has been closed by <@614868464930258958>.