User:BoundedBeans/Weird Befunge Conditionals

From Esolang
Jump to navigation Jump to search

Befunge normally has two main conditionals, _ and |. But there are definitely way more. This method is a great, efficient (in processing, clearly not in space) equivalent to a switch statement.

Start by self-modifying a v into the code somewhere. Then, enter that section moving to the right. Position right arrows at different heights depending on where the pointer began moving down.

Here’s an example:

"v"X8+0p 
                  @@@@@@@@@@@@@@@@@@@@
        >           "oreZ",,,,@       
         >          "enO",,,@
          >         "owT",,,@
           >        "eerhR",,,,,@
            >       "ruoF",,,,@
             >      "eviF",,,,@
              >     "xiS",,,@
               >    "neveS",,,,,@
                >   "thgiE",,,,,@
                 >  "eniN",,,,@

That program prints out the written out name for the digit you replace the X with.

You can of course do this in other directions. The right arrows can also be moved farther apart to allow things like bigger code or even nesting this.