Programming-Idioms

History of Idiom 2 > diff from v116 to v117

Edit summary for version 117 :
Admin deletes impl 4025: OT

Version 116

2020-05-31, 02:55:43

Version 117

2020-05-31, 10:30:39

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration
Code
-export([while/1,while/2, start/0]).

while(L) -> while(L,0).
while([], Acc) -> Acc;

while([_|T], Acc) ->
  io:fwrite("~w~n",[Acc]),
  while(T,Acc+1).

start() ->
  X = lists:seq(1,99),
  while(X).