switch





switch() \ Language (API) \ Processing 1.0
























Search processing.org:





Language (A-Z) \ Libraries \ Tools \ Environment \ Compare \ Troubleshooting






Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name switch() Examples int num = 1; switch(num) { case 0: println("Zero"); // Does not execute break; case 1: println("One"); // Prints "One" break; }char letter = 'N'; switch(letter) { case 'A': println("Alpha"); // Does not execute break; case 'B': println("Bravo"); // Does not execute break; default: // Default executes if the case labels println("None"); // don't match the switch parameter break; }// Removing a "break" enables testing // for more than one value at once char letter = 'b'; switch(letter) { case 'a': case 'A': println("Alpha"); // Does not execute break; case 'b': case 'B': println("Bravo"); // Prints "Bravo" break; } Description Works like an if else structure, but switch() is more convenient when you need to select between three or more alternatives. Program controls jumps to the case with the same value as the expression. All remaining statements in the switch are executed unless redirected by a break. Only primitive datatypes which can convert to an integer (byte, char, and int) may be used as the expression parameter. The default is optional. Syntax switch(expression) { case label: statements case label: // Optional statements // " default: // " statements // " } Parameters expression byte, char, or int label byte, char, or int statements one or more statements to be executed Usage Web & Application Related casedefaultbreakif()else

Updated on November 22, 2008 08:39:25pm PST












Processing was initiated by Ben Fry and Casey Reas. It is developed by a small team of volunteers.


© Info \

Site hosted by Media Temple!









Wyszukiwarka

Podobne podstrony:
understanding switching?sics
Switching Networks AGH Eng
switch
Commodore 64 Classix Switch Edition [v 2] info
Switched at Birth [1x20]s01e20 hdtv xvid fqm
Switches
sprawozdanie switch
MikroTik jako zarządzany switch
easy500 700 7 day time switch HLP EN
Tesla?ttery Switch PGFED
Snowboard Switch [2007] DVDRip(Forestt21)
switchhtml
control structures switch
Lan switching

więcej podobnych podstron