Jump to content

Multiway branch

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 81.129.34.186 (talk) at 16:09, 10 November 2009 (External links add knuth quotation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A multiway branch is a computer science term used to describe the change to a programs control flow based upon a value matching a selected criteria. It is a form of conditional statement. A multiway branch is often the most efficient method of passing control to one of a set of program labels, especially if an index has been created beforehand from the raw data.

Examples

Quotations

Multiway branching is an important programming technique which is all too often replaced by an inefficient sequence of if tests. Peter Naur recently wrote me that he considers the use of tables to control program flow as a basic idea of computer science that has been nearly forgotten; but he expects it will be ripe for rediscovery any day now. It is the key to efficiency in all the best compilers I have studied.

— 

"Structured Programming with go to Statements" by Donald Knuth