# <span class='text-muted'>041.</span> Use `g0.d` and `:` edit descriptors with infinite repeat count to write delimited (CSV, etc.) output

<span style='font-size: small;' class='text-muted'>topic: {ref}`input-and-output`</span>

- `g0.d` will appropriately format any intrinsic type.
- `:` causes processing to stop until the next I/O list item.
- `*` repeats a format group as many times as necessary.

```{literalinclude} ../../src/csv.f90
:language: fortran
:caption: csv.f90 | <a href="https://github.com/zmoon/FortranTipBrowser/blob/main/src/csv.f90" target="_blank" title="See this source on GitHub"><i class="fab fa-github"></i></a> | <a href="https://godbolt.org/#g:!((g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:fortran,selection:(endColumn:1,endLineNumber:15,positionColumn:1,positionLineNumber:15,selectionStartColumn:1,selectionStartLineNumber:15,startColumn:1,startLineNumber:15),source:'program+csv%0A+++implicit+none%0A%0A+++integer+::+x,+y%0A+++integer,+parameter+::+n+%3D+3%0A+++character(len%3D*),+parameter+::+fmt+%3D+%22(*(g0.5,+:,+!',!'))%22%0A%0A+++print+fmt,+%22x%22,+%22y%22,+%22r%22%0A+++do+x+%3D+1,+n%0A++++++do+y+%3D+1,+n%0A+++++++++print+fmt,+x,+y,+norm2(real(%5Bx,+y%5D))%0A++++++end+do%0A+++end+do%0A%0Aend+program+csv%0A'),l:'5',n:'0',o:'Fortran+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:gfortran112,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:fortran,libs:!(),options:'',selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1,tree:'1'),l:'5',n:'0',o:'x86-64+gfortran+11.2+(Fortran,+Editor+%231,+Compiler+%231)',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',m:62.300683371298405,n:'0',o:'',t:'0'),(g:!((h:output,i:(compiler:1,editor:1,fontScale:14,fontUsePx:'0',tree:'1',wrap:'1'),l:'5',n:'0',o:'Output+of+x86-64+gfortran+11.2+(Compiler+%231)',t:'0')),header:(),l:'4',m:37.699316628701595,n:'0',o:'',s:0,t:'0')),l:'3',n:'0',o:'',t:'0')),version:4" target="_blank" title="Open in Godbolt Compiler Explorer"><img src="https://raw.githubusercontent.com/compiler-explorer/compiler-explorer/main/views/resources/site-logo.svg" alt="Godbolt Compiler Explorer logo" width="55.11" height="16.7" class="align-text-bottom" /></a> | <a href="https://play.fortran-lang.org/?code=program%20csv%0A%20%20%20implicit%20none%0A%0A%20%20%20integer%20%3A%3A%20x%2C%20y%0A%20%20%20integer%2C%20parameter%20%3A%3A%20n%20%3D%203%0A%20%20%20character%28len%3D%2A%29%2C%20parameter%20%3A%3A%20fmt%20%3D%20%22%28%2A%28g0.5%2C%20%3A%2C%20%27%2C%27%29%29%22%0A%0A%20%20%20print%20fmt%2C%20%22x%22%2C%20%22y%22%2C%20%22r%22%0A%20%20%20do%20x%20%3D%201%2C%20n%0A%20%20%20%20%20%20do%20y%20%3D%201%2C%20n%0A%20%20%20%20%20%20%20%20%20print%20fmt%2C%20x%2C%20y%2C%20norm2%28real%28%5Bx%2C%20y%5D%29%29%0A%20%20%20%20%20%20end%20do%0A%20%20%20end%20do%0A%0Aend%20program%20csv%0A" target="_blank" title="Open in Fortran Playground"><img src="https://raw.githubusercontent.com/fortran-lang/playground/main/frontend/src/fortran-logo.png" alt="Fortran logo" height="15.5" class="align-text-bottom" /></a>
```

```{code-block} text
:caption: Output[^gfortran-version]

x,y,r
1,1,1.4142
1,2,2.2361
1,3,3.1623
2,1,2.2361
2,2,2.8284
2,3,3.6056
3,1,3.1623
3,2,3.6056
3,3,4.2426

```

[^gfortran-version]: Compiled using `GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0` with no flags

```{note}
Intrinsic function `norm2` is part of the Fortran 2008 standard.
```

---

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Combine the G0.d and colon edit descriptors, along with infinite repeat count, to write delimited (CSV, etc.) output. <a href="https://t.co/QfMmdEj7Fn">pic.twitter.com/QfMmdEj7Fn</a></p>&mdash; FortranTip (@fortrantip) <a href="https://twitter.com/fortrantip/status/1473680777279852553?ref_src=twsrc%5Etfw">December 22, 2021</a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>