====== CASE ====== /* Remove the comments after creating content for each section.*/ Starts a block of commands to execute if a variable has one of multiple values — or starts a multiple-choices decision structure itself /* For the lines below, just create links, separated by commas, to other pages of the BASICs section, like [[:basics:basicTagName]]. "Implemented by" should mention BASICs which implement the keyword like described, in a more usual and standard way. "With variations" should point to BASICs where this keyword is used a bit differently. "Also written as" should list alternative spellings and abbreviations this keyword has. No need to refer to a BASIC, there is a section for that later. */ **Implemented by:** [[:basics:ANSI:ansifull]], [[:basics:bwbasic:]], [[:basics:bwbasic:bw32]], [[:basics:msqb:QBasic]], [[:basics:VBDOS:]], [[:basics:FreeBASIC:]], [[:basics:Gambas:]], [[:basics:EndBASIC:]] **With variations:** **Also written as: ** ===== Usage ===== /* For inline examples of syntax, write the keyword between '' and '' (two single quotes) */ Multiple CASEs are usually part of a [[SELECT_CASE|SELECT-CASE]] branching structure. See the page for examples. ==== Variations ==== Modern versions of BBC BASIC replace the traditional SELECT-CASE structure with a SQL-like structure where the CASE keyword names the whole structure, such as the following example [[https://www.bbcbasic.co.uk/bbcwin/tutorial/chapter10.html|taken from //"An Introduction to Programming BBC BASIC"//]]: CASE Choice% OF WHEN 1: PRINT "You chose option 1" WHEN 2: PRINT "You chose option 2" WHEN 3: PRINT "You chose option 3" ENDCASE ===== Examples ===== /* Below is an example of a code block, using GeSHi syntax highlighting for //gwbasic//. Other styles of interest might be //basic4gl//, //blitzbasic//, //freebasic//, //gambas//, //locobasic//, //purebasic//, //qbasic//, //sdlbasic//, //thinbasic//, //vb//, //vbnet//, //xbasic// or //zxbasic//. 10 PRINT "HELLO" */ ===== Comments ===== /* Origin of the keyword, opinions, history... */ ===== Related keywords ===== /* Keywords that are often or always used along this one */ * [[SELECT_CASE|SELECT CASE]] * [[ENDCASE]] * [[WHEN]] * [[OTHERWISE]] ===== Similar keywords ===== /* Keywords with the same or similar functionality found in other versions of BASIC */ * [[IF]], [[THEN]], [[ELSE]] ===== In other languages... ===== /* For parallels and comparisons with other modern-day languages */ Tcl, C and C-derived languages such as JavaScript and Java provide the equivalent //switch-case// structure. ===== References ===== /* If you used the ((citation)) syntax elsewhere in the text, they will appear under this section. But you can write some recommendations of books, magazines, etc */ /* ===== TAGS ===== Please use the syntax below for adding tags to this page, separated by spaces (use quotes for tags with spaces). The most important tags to be used are, separated by groups: - Statements | Commands | SpecialVariables | Operators {{tag>tagName}} */ {{tag>Statements Branching Decision "Program Flow"}}