Ctrl+P again to print, arrows/tab to navigate results, enter to confirm

    The Calendar hole will go live in approximately . Why not try and solve it ahead of time?

    Quick tips

    Output

    Erlang lacks a function that "just prints" a value, with or without a trailing \n. Instead, you have to pick (and possibly combine) cleverly. Also consider whether the text you want to print is the "standard syntax" of a number or atom.

    io:read/1: The Last Call

    If there are multiple calls to io:read/1, and the last call to io:read/1 is also the last call to any function in io, then this call (the "Last Call") may or may not print its argument, and this behavior can change between runs, seemingly at random.

    erlang:display/1 is not an io function, and does not cooperate well with the Last Call; if the Last Call works, and erlang:display/1 is called at least once since then, then the output from the Last Call can appear after the output of any of the erlang:display/1 calls, either after or before the trailing \n, but never before the output of the first erlang:display/1 call.

    Working around the Last Call

    Remember that a printed "string" can be "deep", hence an expression like [io:read(f(I)) || I <- L] can often be written as io:read([f(I) || I <- L]) instead, to have only one call (the first call can't be the Last Call).

    io:nl/0 is an io function, hence if you're using an io:read/1-then-io:nl/0 pattern to print a line, then this io:read/1 call is not the Last Call (as long as io:nl/0 is, in fact, called there).

    If there's at most one erlang:display/1 call after the Last Call, and the Last Call's argument only contains whitespace, then, on code.golf, the Last Call will never print the whitespace (and thus consistent output is guaranteed), since trailing whitespace is truncated. This is counterproductive, however, if you do want the whitespace printed before the term.