Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs

Dashboard
Notifications
Mark all as read
Challenges

"Hello, {name}!"

+2
−1

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.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

2 comment threads

Output rules (2 comments)
A note about self answers (2 comments)

14 answers

You are accessing this answer with a direct link, so it's being shown above all other answers regardless of its score. You can return to the normal view.

+0
−0

Python 3, 27 bytes

print(f"Hello, {input()}!")

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+3
−0

Bash, 20 bytes

echo "Hello, `cat`!"

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+3
−0

jq, 14 bytes

"Hello, \(.)!"

Try it online!

jq has expression interpolation, pretty epic!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+2
−0

C (gcc), 43 bytes

a[99];main(){printf("Hello, %s!",gets(a));}

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

a[] (2 comments)
+2
−0

Haskell, 43 35 bytes

main=interact$("Hello, "++).(++"!")

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

AWK, 21 bytes

{print"Hello, "$0"!"}

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

shortC, 30 bytes

B){Cs[100];Qs);R"Hello, %s!",s

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

Japt, 10 bytes

`HÁM, {U}!

Try it

The backtick decompresses a compressed string, the {} is Japt's string interpolation and U is the first input variable.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

Sclipting, (UTF-16) 14 bytes

낆녬닆묬글⑴긐
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

JavaScript, 28 bytes

alert(`Hello, ${prompt()}!`)

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+0
−0

Ruby, 21 bytes

puts"Hello, #{gets}!"

Try it online!

@snail_'s solution. I'll be giving them the credit since I don't want to change the input.

Ruby, 24 bytes

puts'Hello, '+gets()+'!'

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

21 bytes (1 comment)
+0
−0

Lua, 35 32 bytes

print("Hello, "..io.read().."!")

Try it online!

Golfed 3 bytes thanks to @Moshi's advice.

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Inline (1 comment)
+0
−0

Java (JDK), 134 123 118 bytes

interface M{static void main(String[]a){System.out.print("Hello, "+new java.util.Scanner(System.in).nextLine()+"!");}}

Try it online!

Golfed 5 bytes thanks to @user's advice.

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Did you even try golfing this? The two variable assignments look entirely useless to me. (3 comments)
+0
−0

PHP, 55 27 21 bytes

Hello, <?=$argv[1]?>!

Try it online!

Golfed 28 bytes thanks to my Software CD post. Golfed 6 bytes thanks to @Shaggy's advice.

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

21 bytes (1 comment)

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate