At runtime, keep prompting for a line of input until the user inputs something (other than an empty newline), i.e. does not just press Enter or OK. Output or result is neither required nor prohibited.

### Pseudo-code 1

myform = new form("GUI")
myform.mytxt = new editfield("")
myform.ok = new button("OK")
repeat
waitfor(myform.ok,"click")
until myform.mytxt.content <> ""


### Pseudo-code 2

LET TEXT = ""
WHILE TEXT = "" DO
TEXT = PROMPT("")
ENDWHILE


### Example 1

Program runs and immediately pops up a form with a single text field and an OK button.
User clicks the OK button.
Nothing happens.
User pastes "hello world" into the text field and clicks the OK button.
Program terminates.

### Example 2

Function is called and immediately displays a blank line and a blinking cursor.
User presses Enter.
Cursor moves down one line.
User presses Enter.
Cursor moves down one line.
User presses PPCGEnter
Function returns.

• is it allowed to count space-only lines as empty? May 4 '17 at 9:25
• @12431234123412341234123 No.
May 4 '17 at 9:29
• Is it necessary to wait for the full line once the user starts to input data? May 7 '17 at 13:22
• Ok, from a comment in @CodyGray's deleted answer it seems like it's not allowed. May 7 '17 at 14:54
• @MatteoItalia Yes, correct; a line of input.
May 7 '17 at 15:17

# TI-BASIC, 2 bytes

:Prompt X


TI-BASIC does this automatically. Once input is given, it will quit.

Here is a GIF:

Watch the count on the enter key in the Key Press History. Created with TI-SmartView CE and ezgif.com.

• Hmm.. this is 2 bytes? May 4 '17 at 16:06
• TI-BASIC is token based. May 4 '17 at 16:11
• And it will not take Enter for an answer? Is there anywhere to test this online?
May 5 '17 at 5:47
• @Adám It won't take enter for an answer. As far as I am aware, there isn't any place you can go to online without already having a TI ROM image. I can post a .gif when I get home, though. May 5 '17 at 15:16
• @Adám It's illegal to test TI-BASIC online without owning a ROM yourself. May 7 '17 at 14:12

# Python 3, 18 bytes

while''==input():0


Try it online!

• So, you'll keep adding another language every 9 minutes?
May 4 '17 at 4:58

# sed, 4

/./q


Waits for a line of input that has 1 or more characters, then quits.

Try it online. But it works better on a live shell:

sed '/./q'


# JavaScript, 3722 17 bytes

while(!prompt());


while(!prompt());

## Explanation

The while keyword starts the while loop. In the condition of the loop, !prompt() asks for input and checks whether it is given or not. If it isn't given, the body of the loop is executed, which in our case is empty, then the interpreter goes back to the loop condition. The same process happens over and over again until the user gives the input.

• while(""==prompt(""));
May 4 '17 at 5:01
• @Adám Wow. I was just thinking about how to make the solution smaller, and you came up with an answer thanks! May 4 '17 at 5:12
• It seemed obvious. However, my browser console refuses to execute without a trailing ;, while your initial expression worked fine without ;. Any idea why?
May 4 '17 at 5:13
• No, Chrome. So if any JavaScript engine can handle omission of the current expression's ;, you can save that byte :-)
May 4 '17 at 5:18
• @Adám Just figured out the real cause of the error produced after the removal of semicolon from the source code. The reason why that happens is that while loop expects a statement (or a group of statements) as the loop body after the loop condition. Adding the semicolon makes it think that the loop body is over. However, removing the semicolon causes it to expect the next statement as the loop body. But in our case, no new statements comes after the loop condition. So, it throws an error. I hope it is clear now. I am terrible at explaining stuff!! :p May 4 '17 at 6:00

# Java, 55 bytes

void f()throws Exception{while(System.in.read()==10);}}


If I remember correctly (it's been a while since I've been active on PPCG), my program can just be a function.

This is system specific; it only works on systems where the end-of-line character is a single newline. If the end-of-line character is instead a carriage return, replace the 10 with 13. On Windows, this doesn't work, as end-of-line on windows is \r\n.

This makes use of the fact that I can read directly from System.in.

• Welcome back, if only for this answer! :D May 4 '17 at 11:17
• Welcome back @Justin! May 4 '17 at 14:45
• Not planning on being active; just dropping by for a question here and there May 4 '17 at 14:48
• To avoid the "doesn't work on Windows" problem, can't you just test the first character and see if it is \r, as opposed to testing the entire string, and then running into problems with there being 2 EOL characters? May 5 '17 at 12:58
• @CodyGray No. I'm reading 1 char at a time; that's all that System.in let's you do directly (well, you chan read an array of chars at a time). My loop body (empty) is run for every char in the input May 5 '17 at 15:03

# HTML5, 33 22 bytes

<form><input required>


<form><input required>

## Explanation

The required attribute on the <input> causes the browser to inform the user "this field is required"-sort-of-message, if they do not enter a value. However, when they enter a value, the value is sent to the URL of the action attribute of the <form> (which in our case is the current file itself, since we haven't specified any value explicitly).

This was tested on the latest version of Google Chrome (version 55.0). May work in other browsers and versions.

• action=/ might work on some browsers.
– Neil
May 4 '17 at 8:05
• You could probably ditch the action attribute altogether. May 4 '17 at 10:56
• @Arjun The action=y.p isn't necessary, as most User Agents will submit to the same location if no action is specificed
– bren
May 4 '17 at 13:18
• @Arjun I've tried <form><input required> on the latest Google Chrome version and works as intended. And if you're skeptical, just use action=#. That saves 2 bytes. May 5 '17 at 4:04
• @Arjun That is a terrible idea for code golfing. I can't say about every browser, since I don't own any Android 1.0, 1.6, 2.0, 2.1, 3.0, 3.1, 4.x.x, 5.x, 6.x, ..., iPhone 2 - 7, every single release of Google Chrome, Firefox 3.0+ and on and on and on and on... In fact, not all HTML5 browsers implement the required attribute! Also, # is a path available since HTML 1.0, if I'm correct. And adding no action to your form is the same as action=".", which is the file itself. May 5 '17 at 7:38

# Jelly, 3 bytes

ɠṆ¿


Not much to look at on TIO, I'm afraid.

Try it online!

### How it works

This is a niladic program, meaning that it takes no input arguments. The implicit argument and return value are both 0 in this case.

¿ (while) is a quick that pops two links from the link stack: a condition (Ṇ) and a body.

Ṇ is a monadic atom: flat logical NOT. If the previous return value is falsy (here, 0 or an empty string), it returns 1 and the body is called.

ɠ is a niladic atom; it reads a raw line from STDIN and returns the result.

Once ɠ reads a non-empty line, Ṇ returns 0 and we break out of the loop.

• That fast, eh? Ah, well.
May 4 '17 at 4:50

# Pyth, 3 bytes

W!w


Try it online!

Translated to Python:

while Pnot(input()):
pass


# brainfuck, 26 bytes

+[>,----------[[-]<[-]>]<]


Try it online!

• That TIO link is all nice and well, but it is a bit hard to tell what happens when run… ;-)
May 4 '17 at 5:59
• @Adám you can append ,. to the end to verify. May 4 '17 at 6:00

# Perl 5, 8+1 (-p or -n flag) bytes

/./&&die


Takes input from stdin and dies as soon as the regex matches anything except a newline.

# C, 52 bytes, 33 bytes, 29 bytes

-19 bytes thanks to Justin

-4 bytes thanks to Christoph

main(){while(getchar()==10);}


10 is equal to '\n' - In case this isn't obvious.

• You can golf it by 1 char by using a ; instead of the {} for the while loop May 4 '17 at 7:07
• Although not standards compliant, you can remove the #include<stdio.h> if you switch to while(getchar()==10): int main(){while(getchar()==10);}. May 4 '17 at 7:17
• @Justin main(){while(getchar()==10);} is enough no need for default int. May 4 '17 at 8:10
• main(){scanf("%s");} would also work, if space-only lines can count as empty. May 4 '17 at 9:33
• @DanielEarwicker You are right. That didn't seem clear to me the first time I read the question, but now I see what you are saying. In that case, there are many non-conforming answers to this question. May 7 '17 at 7:54

## Bash, 51 bytes (39 without "#!/bin/bash")

It's my first time participating in PPCG, so dont be to rude ;D

#!/bin/bash