# Writeln in p5.js

**URL:** <https://discourse.processing.org/t/writeln-in-p5-js/7010>\
**Category:** Coding Questions\
**Created:** [December 30, 2018, 1:01am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010 "2018-12-30T01:01:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![willianxz](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@willianxz](https://discourse.processing.org/u/willianxz)\
**Post date:** [December 30, 2018, 1:01am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/1 "2018-12-30T01:01:37Z")

</div>

Hello my friends, I would like to save a txt file with the broken lines, but I am not finding a command similar to println to write to the .txt file

The only one I found was the write.print which unfortunately does not break the line.

I’ve already tried using write.println, but that does not work it keeps saving everything on the same line = /

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [December 30, 2018, 1:08am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/2 "2018-12-30T01:08:55Z")

</div>

Each time you call `write.print()` it should print a new line. You could also create a new line by writing `"\n"` where you want a line break.

---

<div class="post-metadata">

**Author:** ![willianxz](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@willianxz](https://discourse.processing.org/u/willianxz)\
**Post date:** [December 30, 2018, 1:11am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/3 "2018-12-30T01:11:55Z")

</div>

Try to make this exemple with break the line, and post here please:  
[https://p5js.org/reference/#/p5/createWriter](https://p5js.org/reference/#/p5/createWriter)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 30, 2018, 1:45am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/4 "2018-12-30T01:45:39Z")

</div>

why you not link us to your code?  
[https://editor.p5js.org/kll/sketches/BkLEziSb4](https://editor.p5js.org/kll/sketches/BkLEziSb4)

---

<div class="post-metadata">

**Author:** ![willianxz](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@willianxz](https://discourse.processing.org/u/willianxz)\
**Post date:** [December 30, 2018, 1:56am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/5 "2018-12-30T01:56:22Z")

</div>

Why am I trying to edit in the example itself.

Look at this example:  
[https://p5js.org/reference/#/p5/createWriter](https://p5js.org/reference/#/p5/createWriter)

It just saves the numbers all together on the same line, what I wanted to do is that it breaks the line to each number.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 30, 2018, 1:59am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/6 "2018-12-30T01:59:35Z")

</div>

ok, problem is it works here fine, the example / and my example ( to show @Sarah ) “\n” idea  
“here” is Raspberry Pi Linux RASPBIAN

 ![2018-12-30_09-01-34_snap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/252c360960512fb2f19a424da391556bae140b57.png)  
so i must ask, what computer , OS, file viewer you use when you open that file from your download folder

---

<div class="post-metadata">

**Author:** ![willianxz](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@willianxz](https://discourse.processing.org/u/willianxz)\
**Post date:** [December 30, 2018, 2:00am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/7 "2018-12-30T02:00:45Z")

</div>

Look:

 ![Capturar](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9bfaeb5ee39b2d6f3154f3ba4c052107221f8138.png)

I do not want the example to save the numbers like this.  
I wanted the example to save the numbers with broken lines like this:

 ![Capturar](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2b55f4c1e3eff6f89ef44620daae8503e9179b2d.png)

---

<div class="post-metadata">

**Author:** ![willianxz](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@willianxz](https://discourse.processing.org/u/willianxz)\
**Post date:** [December 30, 2018, 2:05am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/8 "2018-12-30T02:05:35Z")

</div>

I am using windows 8.

I do not know why, but in my notepad everything stays together, even with line wrapping turned on or off.

I grabbed the .txt file and threw it in the browser, showed the file with the line breaks.

 ![Capturar](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/728bcfb380f0df8044e0c4a9fa39a522c74e636d.png)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 30, 2018, 2:10am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/9 "2018-12-30T02:10:35Z")

</div>

so it is about the win8 notepad  
pls check if there is some adjustment under the “Formatar” menu?

---

<div class="post-metadata">

**Author:** ![willianxz](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@willianxz](https://discourse.processing.org/u/willianxz)\
**Post date:** [December 30, 2018, 2:15am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010/10 "2018-12-30T02:15:05Z")

</div>

No formatting only changes the font size, and activating the line break or turning off, remains the same.

The alternative I think will be to put in the browser the notepad to be able to see broken the numbers.

I do not know why notepad in windows 8 does this, the strange thing is that if you manually put the formatting with line break remains.

Thank you for helping me!
