New answers tagged

1

CSS, 62 bytes: *{display:none}html{display:flex}:after{content:'Hello World!' This is the first pure CSS on here, I think.


1

(Non-competing) Python 3, Quine + Cat = Hello World, 92 bytes (Quine is invalid) The Quine turns into a Hello World program when the file length is long enough. The print(...)+exit() is a cute trick; since exit() never returns, then it may be combined with the None returned by print(...) with any operator, such as +. Quine: t=open(__file__).read() print(t)if ...


2

Arn, 6 bytes 'Mh└a└ Explanation Unpacked: 'yt, bs! A compressed string where every word is capitalized. Output is implicit


0

Java (JDK), 123 bytes /*/ */System.out.print("Hello, world!"); ///\ u 0 0 0 d S y s t e m . o u t . p r i n t ( " H e l l o_,_ _w o r l d ! " ) ; Try it online! This isn't a full program - you'll have to paste it into a method somewhere. Every other character, 62 bytes //*Sse.u.rn(Hlo ol!) /\u000dSystem.out.print("Hello, world!&...


3

R, Quine (74 51 bytes) + Cat (77 74 bytes) = Hello world 151 125 bytes R, Hello world (173 174 bytes) + Cat (77 74 bytes) = Quine 250 248 bytes R, Quine (74 51 bytes) + Hello world (173 174 bytes) = Cat 247 225 bytes A set of Quine, Cat & Hello world from which any 2 can be combined to form the third. Not the shortest answer, but pleasingly symmetric. ...


2

Ruby, 55 bytes IO.write(?l,"Hello, World!");`lpr<<?l` For Mac and Linux, your default printer must be set at localhost:631. For Windows, you need to add an lpr port in your printer settings.


0

Keg, 47 39 35 bytes `1H1%1;1,1 1c1¡1;1!1`_`H%;, c¡;!` $ Try it online! And, unless I've somehow misread the challenge, the program with alternating characters: -hd, 18 bytes `H%;, c¡;!``%,c;`$ Try it online!


1

MAWP, 169 bytes 9/8/W/;/5/5/W/4/W/1/M/;/9/3/W/4/W/;/9/3/W/4/W/;/9/4/W/1/M/3/W/;/5/8/W/4/M/;/8/4/W/;/9/8/M/5/W/2/M/;/9/4/W/1/M/3/W/;/9/9/M/1/M/6/W/;/9/3/W/4/W/;/5/5/W/4/W/;/9/2/M/3/W/;/. Try it! Code with every other character removed: 98W;55W4W1M;93W4W;93W4W;94W1M3W;58W4M;84W;98M5W2M;94W1M3W;99M1M6W;93W4W;55W4W;92M3W;. Try It!


1

Rust, 85 bytes | | /**/print!("Hello, World!")//___*//_p_r_i_n_t_!_(_"_H_e_l_l_o_,_ _W_o_r_l_d_!_"_) Try it online Every other character: ||/*pit(Hlo ol!)/_*/print!("Hello, World!") Try it online Full program, 113 bytes /**/fn main(){print!("Hello, World!")}//__*//_f_n_ _m_a_i_n_(_)_{_p_r_i_n_t_!_(_"_H_e_l_l_o_,...


1

PHP, Hello World + Quine = Cat, 117 bytes Because of the input method this only works using the command line. Hello world the double die is because the php code has to get interupted earlier in order to prevent errors being printed (missing function a) <?php if(!function_exists('a')){die('Hello world!');}die(a($argv)); Quine without opening tag, php just ...


3

Jelly, Quine + Cat = Hello World! 17 bytes Note that using a formatted input has been deemed valid and this entry takes input as a command-line argument formatted as a Python string. To have a pure-Cat program we'd need to use STDIN in Jelly, since it first attempts to evaluate any command-line argument as Python. This is achievable in 21 bytes with ”ṘṘ + ”1$...


1

Haskell, Cat + Quine = Hello World, 140 bytes Cat b=interact id main=b where c=1; Quine main=putStr a>>print a;b=putStrLn "Hello world!";a="main=putStrLn a>>print a;b=putStrLn \"Hello world!\";a=" Hello World! b=interact id main=b where c=1;main=putStr a>>print a;b=putStrLn "Hello world!";a="...


1

V (vim), Quine + Hello World = Cat, 32 bytes Quine dG2idG2i Explanation: dG: Delete the buffer (saving it to the unnamed register) 2idG2i: Insert dG2i twice. Hello World "_dG4iHello World! ␛pH3D With trailing newline. TryItOnline also shows a trailing space after that, but this appears to be an artifact of it's V runner. Explanation: "_dG: ...


4

><>, Quine + Cat = Hello World!, 48 bytes Quine "r00gol?!;40. The classic ><> quine Cat "]v"i:0(?;o >l?!;o ^"Hello World!"< A simple cat program, loaded with some other code that isn't being run. Hello World! "r00gol?!;40."]v"i:0(?;o >l?!;o ^"Hello World!"< The quine part makes ...


4

Hello World + Quine = Cat, C (GCC), 149 (81 + 68) Hello World a;main(s){a?read(0,&s,1)&&main(putchar(s)):puts("Hello World!");} #define main m Try it online! Quine a=1;main(s){printf(s="a=1;main(s){printf(s=%c%s%1$c,34,s);}",34,s);} Try it online! Cat (Hello World + Quine) a;main(s){a?read(0,&s,1)&&main(putchar(s)...


4

Alice, Cat + Quine = Hello World, 51 bytes Cat: (With trailing newline) \ > "!dlroW olleH"d&O@ ^/ v # < i Try it online. Uses # to skip the redirect west and instead hit the redirect south into the i, which pushes the input as a string to the top of the stack. The instruction pointer then reflects off the top and bottom boundaries ...


4

Aceto, quine (67) + cat (33) = Hello World (100 bytes*) (*I counted one file including a final newline so that catting them together works as expected) quine (made it for this challenge): £"24«cs%55«3+cp24«2+cdpsdpsppn"24«cs%55«3+cp24«2+cdpsdpsppn cat: X n p el r"HlX ^^ oldnp ^Wor!" The quine itself was the hardest part, due to the ...


3

05AB1E, Quine + Hello World = Cat, 23 bytes Quine: 2096239D20BJ Try it online (with input) or try it online (without input). Hello World: I.gi”Ÿ™‚ï! Try it online (with input) or try it online (without input). Cat: 2096239D20BJI.gi”Ÿ™‚ï! Try it online (with input) or try it online (without input). (All three output with trailing newline.) Explanation: ...


6

Keg, Hello World + Quine = Cat, 26 bytes «H%c¡|,!«``:[④|᠀,]`:[④|᠀,] Try it online! How it Works Hello World «H%c¡|,!«` Try it online! This is my answer to the HW challenge with some additional string closing syntax. Why? Because a) the main string needs closing to be concatenated and b) the end ``` is needed to "ignore" the quine part Quine (non-...


12

Bash, Quine + Cat = Hello World, 110 bytes Quine q='eval printf "$s" "$s"';s='q=\47eval printf "$s" "$s"\47;s=\47%s\47;$q';$q Cat true false&&cat||echo Hello World! Hello World q='eval printf "$s" "$s"';s='q=\47eval printf "$s" "$s"\47;s=\47%s\47;$q';$qtrue false&&...


7

Wolfram Language (Mathematica), Quine + Cat = Hello World, 15 + 28 = 43 bytes 3 functions. Quine ToString[#0] & Try it online! Cat 1/.{1->#,_->"Hello World!"}& Try it online! Hello World ToString[#0] & 1/.{1->#,_->"Hello World!"}& Try it online! Cat and Hello World can be interchanged by swapping the # and &...


20

Python 3, Hello World + Quine = Cat, 129 bytes Hello World: import os,atexit as a p=print a.register(p,"Hello World!") def print(_): p(input()) os._exit(0) Quine: s='s=%r;print(s%%s)';print(s%s) Cat: import os,atexit as a p=print a.register(p,"Hello World!") def print(_): p(input()) os._exit(0) s='s=%r;print(s%%s)';print(s%s) ...


7

Python 2, Hello World + Cat = Quine, 200 198 189 bytes Hello World id=0;a="Hello World!";a0='id=0;a="%s";a0=%r;print a0%%((a,a0)if id<1else 1)\nimport sys\nif id:print sys.stdin.read()';print a Cat 0%((a,a0)if id<1else 1) import sys if id:print sys.stdin.read() My previous answer was actually wrong. raw_input only reads one line. ...


6

Rust, Quine + Cat = Hello, world! (106 + 2 = 108 bytes) Quine (108 106 bytes): -2 bytes: removed ',' from "Hello world!" let s=format!("Hello world!");format!("{},{0:?})","let s=format!(\"Hello world!\");format!(\"{},{0:?})\"") .into() instead of format! saves a few bytes but is context-dependent. ...


8

R, Quine + hello, world = cat; 48 + 49 ... 43 + 44 = 87 bytes Or 75 bytes as internal code of functions and not including function(){} wrappers. Edit: -14 bytes thanks to Robin Ryder! Nontrivial quine: '->T;cat(sQuote(T),T)' ->T;cat(sQuote(T),T) Try it online! Hello,world: ~F->y;cat(`if`(T>0,"Hello world!",scan(,T))) Try it online! ...


7

Quine + Cat = Hello World, Jelly, 25 bytes -2 bytes thanks to @Jonathan Allan Quine (12 bytes) “Ṿṭ⁷;⁾v`”v` (starts with a newline) Try it online! Cat (13 bytes) Ṇ “,ḷṅḳȦ»³ÑƑ? Try it online! (argument quoted to avoid casting to a Python object from string as per @Jonathan Allan's suggestion) Hello World (25 bytes) “Ṿṭ⁷;⁾v`”v`Ṇ “,ḷṅḳȦ»³ÑƑ? (starts with a ...


4

Integral, 13 bytes ÷Hello, W╗ld! Try it! Sadly, Integral cannot yet compress capital letters, so it could not do much compression. ÷ means start compressed string. Ignoring punctuation and capitalization yields Integral, 9 bytes ÷▓llo═╗ld Try it! See also: Showcase


Top 50 recent answers are included