"Hello, {name}!"
Background
While we do have a "Hello, World!" challenge, we still don't have one regarding input. So let's do one!
Challenge
Create a program that takes an input (not as a function argument) then outputs Hello,
, the variable and !
altogether. Standard I/O only applies. Shortest submission per language wins!
Bonus: Use your username as the input.
[jq], 14 bytes "Hello, …
3y ago
[Bash], 20 18 bytes Saved t …
2y ago
[C (gcc)], 43 bytes …
3y ago
[Haskell], 43 35 bytes …
3y ago
Japt, 10 bytes `HÁM, {U …
3y ago
JavaScript, 28 bytes …
3y ago
[AWK], 21 bytes {print" …
3y ago
[shortC], 30 bytes B){C …
3y ago
[Ruby], 24 21 18 bytes …
3y ago
[Sclipting], (UTF-16) 14 bytes …
3y ago
[Lua], 35 32 bytes …
3y ago
[Python 3], 27 bytes …
3y ago
[Factor], 30 29 bytes [ …
2y ago
J, 29 char ``` ('!','Hello, …
2y ago
[PHP], 55 27 21 bytes …
3y ago
[Java (JDK)], 134 123 118 byte …
3y ago
16 answers
Bash, 20 18 bytes
Saved two bytes by removing the quotes; the code works well without them.
echo Hello, `cat`!
0 comment threads
PHP, 55 27 21 bytes
Hello, <?=$argv[1]?>!
Golfed 28 bytes thanks to my Software CD post. Golfed 6 bytes thanks to @Shaggy's advice.
Java (JDK), 134 123 118 bytes
interface M{static void main(String[]a){System.out.print("Hello, "+new java.util.Scanner(System.in).nextLine()+"!");}}
Golfed 5 bytes thanks to @user's advice.
1 comment thread
J, 29 char
('!',~'Hello, ',1!:1<1)1!:2<4
Sample run
('!',~'Hello, ',1!:1<1)1!:2<4
torres
Hello, torres!
2 comment threads