Programming in Funge

Befunge Techniques

Everyday patterns for writing readable Befunge programs.

A Worked Countdown Program

Follow a two-row Befunge countdown from 9 to 1 one step at a time, with the stack contents and pointer direction written out at every instruction.

4 min read

Printing Strings with Quote Mode

How Befunge's double-quote instruction pushes character codes, why strings come out backward, and three reliable ways to print text in the right order.

4 min read

Reading Numeric Input in Befunge

How the ampersand and tilde instructions read numbers and characters in Befunge, how to convert digit characters to values, and what to watch for at end of input.

4 min read

Subroutines in a Grid Language

Befunge has no call instruction, so reusable routines are emulated. Compare copying code, dispatching a return with a stack value, and rewriting cells.

4 min read

Writing Loops in Befunge

Build counted and conditional loops in Befunge by routing the pointer back over earlier cells, with tested-first and tested-last layouts and common pitfalls.

4 min read

Related topics

More in programming in funge