Skip to content

Commit b3d57fc

Browse files
committed
[#18] iolists
1 parent 2d6b364 commit b3d57fc

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,7 @@ Erlang syntax is horrible amirite? So you might as well make the best of it, rig
233233
##### IOLists over string concatenation
234234
> Use iolists instead of string concatenation whenever possible
235235
236-
```erlang
237-
% bad
238-
"/users/" ++ UserId ++ "/events/" ++ EventsId
239-
240-
% good
241-
["/users/", UserId, "/events/", EventsId]
242-
```
236+
*Examples*: [iolists](src/iolists.erl)
243237

244238
*Reasoning*: Performance
245239

src/iolists.erl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-module(iolists).
2+
3+
-export([good/1, bad/1]).
4+
5+
bad(Param) -> "Hello " ++ binary_to_list(Param) ++ "! Have a nice day!".
6+
7+
good(Param) -> ["Hello ", Param, "! Have a nice day!"].

0 commit comments

Comments
 (0)