Dada uma entrada, produza essa entrada seguida por uma nova linha sem parar.
A entrada será uma sequência que consiste apenas em caracteres ASCII imprimíveis ( 0x20-0x7E
) e novas linhas ( 0x0A
).
Se a entrada tiver comprimento 0, imprima novas linhas de forma interminável.
Isso é código-golfe, e o menor número de bytes em cada idioma vence!
code-golf
string
sequence
combinatorics
fastest-code
number
code-challenge
restricted-source
rosetta-stone
code-golf
arithmetic
decision-problem
integer
factorial
code-golf
arithmetic
decision-problem
integer
bitwise
code-golf
kolmogorov-complexity
code-golf
tips
vim
code-golf
quine
code-generation
code-golf
string
restricted-source
code-golf
string
random
unicode
code-golf
audio
code-golf
ascii-art
code-golf
decision-problem
code-golf
puzzle-solver
code-golf
restricted-source
code-golf
kolmogorov-complexity
permutations
hexagonal-grid
code-golf
string
math
combinatorics
fastest-code
code-golf
restricted-source
code-golf
string
code-golf
arithmetic
code-golf
math
number
code-golf
string
decision-problem
balanced-string
code-golf
binary
code-golf
string
number
code-challenge
restricted-source
code-golf
ascii-art
printable-ascii
interactive
code-golf
string
ascii-art
code-challenge
restricted-source
source-layout
code-golf
arithmetic
tips
functional-programming
golfing-language
code-golf
binary
encryption
Skidsdev
fonte
fonte
Respostas:
Bater , 8 bytes
Experimente online!
fonte
yes
novas linhas, mas qualquer nova linha que possa estar contida na entrada é impressa como\n
. depende de como você lê a pergunta: D./script $'Hello\n World'
para incluir novas linhas reais. No TIO, você pode simplesmente adicionar uma nova linha ao argumento da linha de comandoyes $1
funciona bem para mim05AB1E , 2 bytes
Experimente online!
fonte
[I,
?[=
também funciona e é um rosto sorridente; o sorriso é o único benefício lol.JavaScript (ES6), 24 bytes
Experimente online!
fonte
Ohm , 3 bytes
Experimente online!
Ele não funciona com uma entrada vazia porque Ohm é ruim no manuseio de entrada em comparação com outros idiomas, mas você pode inserir "".
Explicação
fonte
sed, 5
Rótulos sem nome é um "recurso" não documentado no sed que funciona com a versão 4.2.2, mas pode não funcionar em versões futuras.
fonte
Gelatina , 2 bytes
Experimente online!
Imprima com uma nova linha, repita o link inteiro (programa).
fonte
brainfuck , 27 bytes
Experimente online!
fonte
,[>,]++++++++++[[<]>[.>]<]
?Python 2 , 21 bytes
Não assume limite de recursão
Experimente online!
fonte
V, 2 bytes
You can't try this online for obvious reasons.
fonte
V
because the output it inside of an nvim session, and isn't printed to STDOUT until it finishes, TIO kills the session and sees nothing on STDOUT. I didn't know about what you said, but unfortunately it doesn't fix VRuby,
181712 + 2 = 14 bytesRun with the
-n
flag.Edit: Thanks for @sethrin for the
-n
flag!fonte
-n
flag and skip thegets
.AutoHotkey, 20 Bytes
OP did not specify how the output should happen, said only it has to happen endlessly with a newline after it. AHK was not tailored for cmd interaction. So the output happens repeatedly in a
ToolTip
at mouse position:I like AHK's
loop
feature.loop
repeats the next block forever,loop, 10
would repeat it 10 times. Sometimes I miss this feature in other languages like Python.The escape character in AutoHotkey is
`
(so there are no problems with backslashes in Windows paths). For some reason, a trailing newline is ignored so it is needed twice. (trayTip
might not have this "bug" but I cannot test it because running with wine)old answer:
I just realized that OP probably wont like this solution, the output happens with user-interaction and includes no newlines. I'll look for another way.
fonte
LibreLogo, 33 bytes
Code:
Explanation:
Result:
fonte
Python 2, 25 bytes
Try it online!
Input is expected to be a Python literal (quotes for a string, square bracket or parentheses with comma-separated items for a list/tuple, etc.)
Python 3 would be +1 byte because
print
is a function, but also could do raw input without the 4-byte penalty forraw_input()
in Python 2.fonte
Brachylog, 3 bytes
Try it online!
Port of my Jelly answer.
fonte
PHP, 20 bytes
fonte
Haskell, 14 bytes
Try it online!
Append a newline to the input and make list of infinite copies of it.
Alternative version, also 14 bytes:
fonte
Braingolf,
1412 bytesTry it online!
-2 bytes thanks to totallyhuman
Explanation
fonte
C, 24 bytes
Basically a recursive function that outputs the string before calling herself again. Its my second post on codegolf so please be nice :p
fonte
Cubix, 6 bytes
Test it here
N/A
Push Newline(10) and input onto the stackv
redirect into the loopo/q
loop that outputs a character and pushes it to the bottom of the stack continuouslyI was going to remove the EOI (-1) indicator from the stack, but it doesn't appear to affect the output any, so have left it saving bytes.
fonte
Japt, 5 bytes
Try it online!
Explanation
fonte
C#, 40 bytes
fonte
MATL, 4 bytes
Try it Online
Explanation
fonte
C, 26 bytes
A function,
f
, that takes a C-style string as a parameter,s
. The body of the function loops repeatedly, passing the string to the library functionputs
, which outputs the string to the standard output (stdout) along with a trailing new-line.Pretty simple stuff. The only hack here is taking advantage of default-int for the return value and then not actually returning a value. That doesn't matter in this case, though, since the function never returns (it just keeps printing forever)!
Try it online!
fonte
f(char*s){puts(s);f(s);}
saves a fewGroovy, 20 bytes
fonte
Java 8, 34 bytes
Surprised there wasn't a Java answer yet.
Try it here. (Wait 60 second for it to time-out.)
fonte
Real time: 60.008 s
according to the Debug-section before it outputs the result (and gives two warnings 60-sec limit exceeded and 128kb exceeded).Pyth, 2 bytes
Unfortunately I can't removeQ
:(You need to run from command-line like this, so that this is competing:
The interpreter has been fixed too.
fonte
><>, 16 bytes
Try it online!
As mentioned in the comments below my first attempt may have misunderstood the question so the newer 16 byte solution has been made, I have left the original below so people may see.
><>, 13 bytes
Try it online!
fonte
CJam, 6 bytes
Try it online!
fonte
Perl 5, 27 bytes
Try it online!
fonte
while(1){print"$ARGV[0]\n"}
SAS, 32 bytes
fonte