Skip to main content
5 of 5
added 308 characters in body
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180

Pyramid Scheme, 166 156 131 123 bytes

Saved 10 bytes thanks to Pavel! Saved 25 33 bytes thanks to Khuldraeseth na'Barya!

   ^       ^
  / \     / \
 /set\   /do \
^-----^ ^-----^
-    ^- -^   / \
    /l\ /#\ /out\
   /ine\---^-----
   -----   -

Try it online!

Try it online!

Old answer and explanation (functionally equivalent)

    ^        ^
   / \      / \
  /set\    /do \
 ^-----^  ^-----^
/a\   /#\/a\   / \
---  ^------  /out\
    /l\      ^-----
   /ine\    /a\
   -----    ---

Hehe. I love this language.

Explanation

There are two pyramid chains. The first is:

    ^
   / \
  /set\
 ^-----^
/a\   /#\
---  ^---
    /l\
   /ine\
   -----

This sets variable a to line (a line read from STDIN), as a value (#).

The second:

    ^
   / \
  /do \
 ^-----^
/a\   / \
---  /out\
    ^-----
   /a\
   ---

This is a do while loop, with the left pyramid being the condition, and the right one being the body. Equivalent to:

do {
    out(a);
} while(a);

which is what we want.

Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180