Knowledge

Conditional (computer programming)

Source đź“ť

39: 31: 4868: 3290:, which applies the first argument (a function) to each of the elements of the second argument (a list), and returns the resulting list. The two lines are the two definitions of the function for the two kinds of arguments possible in this case – one where the list is empty (just return an empty list) and the other case where the list is not empty. 2811:
Haskell used to use this exact model for its Boolean type, but at the time of writing, most Haskell programs use syntactic sugar "if a then b else c" construct which unlike ifThenElse does not compose unless either wrapped in another function or re-implemented as shown in The Haskell section of this
2219:
ifThenElse takes up to three arguments and once all are provided, it passes both second and third argument to the first argument(which is a function that given two arguments, and produces a result). We expect ifThenElse to only take true or false as an argument, both of which project the given two
1303:
is provided, which can be used as a conditional expression. However, it does not behave like a true conditional expression, because both the true and false branches are always evaluated; it is just that the result of one of them is thrown away, while the result of the other is returned by the IIf
1278:
First, when the user runs the program, a cursor appears waiting for the reader to type a number. If that number is greater than 10, the text "My variable is named 'foo'." is displayed on the screen. If the number is smaller than 10, then the message "My variable is named 'bar'." is printed on the
3297:
a choice construct, because it is possible in Haskell to write only one alternative, which is guaranteed to always be matched – in this situation, it is not being used as a choice construct, but simply as a way to bind names to values. However, it is frequently used as a choice construct in the
1847:
computer. On that computer the test-and-branch op-code had three addresses for those three states. Other computers would have "flag" registers such as positive, zero, negative, even, overflow, carry, associated with the last arithmetic operations and would use instructions such as 'Branch if
1182:
Some argue that the explicit if/then statement is easier to read and that it may compile to more efficient code than the ternary operator, while others argue that concise expressions are easier to read than statements spread over several lines containing repetition.
2833:
or multiway branches) compare a given value with specified constants and take action according to the first constant to match. There is usually a provision for a default action ('else','otherwise') to be taken if no match succeeds. Switch statements can allow
331:
statements to write programs that are not spaghetti code and are just as well structured and readable as programs written in a structured programming language, structured programming makes this easier and enforces it. Structured
582:
In the example above, if the discount is 10%, then the first if statement will be evaluated as true and "you have to pay $ 30" will be printed out. All other statements below that first if statement will be skipped.
768:, which are similar to if statements, but return a value as a result. Thus, they are true expressions (which evaluate to a value), not statements (which may not be permitted in the context of a value). 723:
branch effectively adds an extra nesting level. This complicates the job for the compiler (or the people who write the compiler), because the compiler must analyse and implement arbitrarily long
1370:
passing 2 arguments: The first one being the condition and the second one being the true branch. Both arguments are passed as strings (in Tcl everything within curly brackets is a string).
3450:
This table refers to the most recent language specification of each language. For languages that do not have a specification, the latest officially released implementation is referred to.
2231:
to also pass an empty tuple () to the result of ifThenElse in order to actually call the chosen function, otherwise ifThenElse will just return the function object without getting called.
503:, it is possible to combine several conditions. Only the statements following the first condition that is found to be true will be executed. All other statements will be skipped. 674:
too. Similarly, the earlier UNIX shells (later gathered up to the POSIX shell syntax) use elif too, but giving the choice of delimiting with spaces, line breaks, or both.
311:
statement, gained in popularity, until it became the norm even in most BASIC programming circles. Such mechanisms and principles were based on the older but more advanced
4789: 1392:
Uplevel makes it possible to implement new control constructs as Tcl procedures (for example, uplevel could be used to implement the while construct as a Tcl procedure).
1130:
To accomplish the same using an if-statement, this would take more than one line of code (under typical layout conventions), and require mentioning "my_variable" twice:
2808:
Smalltalk uses a similar idea for its true and false representations, with True and False being singleton objects that respond to messages ifTrue/ifFalse differently.
1404:
The return value from the command is the result of the body script that was executed, or an empty string if none of the expressions was non-zero and there was no bodyN.
336:
statements like the example above are one of the key elements of structured programming, and they are present in most popular high-level programming languages such as
2035:
to the console. Else and else-if statements can also be chained after the curly bracket of the statement preceding it as many times as necessary, as shown below:
4248:
This refers to pattern matching as a distinct conditional construct in the programming language – as opposed to mere string pattern matching support, such as
4322:
statements combined with a particular source code layout. However, this also means that a distinct else–if construct is not really needed in these languages.
2234:
In a system where numbers can be used without definition (like Lisp, Traditional paper math, so on), the above can be expressed as a single closure below:
966:
part is compulsory, as every expression must have some value. Logic that would be expressed with conditionals in other languages is usually expressed with
4872: 4828: 746:, also called case-statement or select-statement. Conversely, in languages that do not have a switch statement, these can be produced by a sequence of 1598:) and its corresponding statement. In GCL, exactly one of the statements whose guards is true is evaluated, but which one is arbitrary. In this code 4739: 109:
return values. Many programming languages (such as C) have distinct conditional statements and conditional expressions. Although in pure
4764: 3412:
or that allow a programmer to assign a named function to a variable reference, conditional flow can be implemented by using a hash as a
2319:
Here, true, false, and ifThenElse are bound to their respective definitions which are passed to their scope at the end of their block.
4570: 90: 4622: 1377:
function receives the condition as a string value and is responsible to evaluate this string as an expression in the callers scope.
985:
can evaluate only the condition and proper branch (where a strict language would evaluate all three). It can be written like this:
140:
construction is used in many programming languages. Although the syntax varies from language to language, the basic structure (in
4894: 4793: 231:, which means "the variable x contains a number that is greater than zero" – and evaluates that condition. If the condition is 4337:
In Haskell and F#, a separate constant choice construct is unneeded, because the same task can be done with pattern matching.
3749: 3674: 3597: 3225: 951: 945: 114: 3963: 3937: 3929: 3854: 3647: 3311: 2860: 1852:, and in cases such as integer arithmetic where overflow may occur, the overflow or carry flags would be considered also. 810: 806: 682: 678: 647: 316: 106: 2027:
if a random float value between 0 and 1 is greater than 0.5. The statement uses it to randomly choose between outputting
4113: 4063: 3435: 1630: 759: 102: 1439:
expression's type is known at compile time, each branch must evaluate to a value of the same type. For this reason, an
4318:
in the C family of languages, and in COBOL and Haskell, is not a language feature but a set of nested and independent
4038: 4013: 3774: 1420: 1414: 799: 698: 341: 1373:
In the above example the condition is not evaluated before calling the function. Instead, the implementation of the
3518: 3493: 1873: 591: 385:
struggled to define which specific statement to target. Without clear boundaries for which statement is which, an
4495: 3724: 3148: 686: 292: 74:
constructs that perform different computations or actions or return different values depending on the value of a
2615:
The first example shows the first branch being taken, while second example shows the second branch being taken.
3568: 2866: 1591: 1583: 1060: 690: 337: 4845: 4825: 4500: 216: 4583: 1848:
accumulator negative' then 'Branch if accumulator zero' or similar. Note that the expression is evaluated
1830: 304: 110: 89:
is not usually classified as a conditional construct, it is another way to select between alternatives at
3143:
statements. It is available in many programming languages with functional programming features, such as
1427:
is always an expression. It evaluates to the value of whichever branch is executed, or to the unit type
296: 2322:
A working JavaScript analogy(using only functions of single variable for rigor) to this is as follows:
1625:
GCL is intended primarily for reasoning about programs, but similar notations have been implemented in
4743: 4647: 3456: 71: 4522: 2835: 375: 243: 2842:. In dynamic languages, the cases may not be limited to constant expressions, and might extend to 4511: 4351: 4249: 4214: 3431: 3425: 3409: 2851: 1865: 1843:
This was the only conditional control statement in the original implementation of Fortran on the
1587: 730:
If all terms in the sequence of conditionals are testing the value of a single expression (e.g.,
4697: 4672: 4484:
Pattern matching was added in Ruby 3.0. Some pattern matching constructs are still experimental.
4813: 4718: 2198:, the concept of an if-then-else conditional can be expressed using the following expressions: 1079:
This means that it can be inlined into expressions, unlike if-statements, in C-like languages:
117:, many languages with conditional expressions (such as Lisp) support conditional side-effects. 4272: 4189: 3543: 3307: 1626: 697:
construct is not present, nor is it present in the many syntactical derivatives of C, such as
224: 212:, having intrinsic meaning (e.g., expressing a coherent logical rule) but no intrinsic value. 75: 4768: 1071:) for conditional expressions with a function that may be described by a template like this: 4537: 4505: 3661: 3475: 3464: 3144: 3132: 3127: 2843: 2826: 2821: 2612:
Another version of the earlier example without a system where numbers are assumed is below.
1064: 967: 743: 86: 51: 38: 4354:
matching is among the conditional flow-control alternatives available. For an example, see
1622:'s are the statements. If none of the guards is true, the program's behavior is undefined. 4832: 4532: 4517: 2195: 974: 595: 239:
are executed. Otherwise, the execution continues in the following branch – either in the
4643: 3438:
feature that enables instructions to be conditionally executed instead of modifying the
307:, which allows (virtually) arbitrary statements to be put in statement blocks inside an 200:) but having no intrinsic meaning. In contrast, the combination of this expression, the 3413: 1431:
if no branch is executed. If a branch does not provide a return value, it evaluates to
323:
influenced modern BASIC variants for many years. While it is possible while using only
85:
Conditionals are typically implemented by selectively executing instructions. Although
4557: 483:
problem, and is resolved in various ways, depending on the language (commonly via the
4888: 3933: 3470: 654:
because structure is denoted by indentation rather than braces, so a repeated use of
480: 361: 278: 1590:
supports conditional execution as a list of commands consisting of a Boolean-valued
30: 4668: 4268: 4163: 3439: 2872: 2847: 2839: 1294: 1288: 667: 662:
would require increased indentation after every condition. Some implementations of
349: 258: 208:
surrounding it, and the consequent that follows afterward constitute a conditional
126: 2227:: if ifThenElse is passed two functions as the left and right conditionals; it is 4527: 3829: 3323: 1187: 814: 4878: 1930:
languages. A Boolean value is accepted within parentheses between the reserved
1649:
statement which jumps to one of three labels depending on whether its argument
867:; Assigns 'myvariable' to 1 or 2, depending on the value of 'x' 4609: 4459: 3988: 3803: 3799: 3699: 1923: 1642: 702: 345: 192:, having intrinsic value (e.g., it may be substituted by either of the values 141: 4693: 4623:"Efficient C Tips #6 – Don't use the ternary operator « Stack Overflow" 1861: 1840:
statements reference the following statement with one or two of the labels.
17: 4373:
SQL has two similar constructs that fulfill both roles, both introduced in
4867: 2213: 2206: 1927: 776: 382: 320: 4271:
sub-language that is used to modify the code before compilation; and to
549:
For example, for a shop offering as much as a 30% discount for an item:
27:
Control flow statement that executes code according to some condition(s)
4596: 1844: 1443:
branch is effectively compulsory unless the other branches evaluate to
677:
However, in many languages more directly descended from Algol, such as
638:
to avoid the large number of braces that would be required by multiple
295:
instruction). This led to a hard-to-read style of programming known as
4355: 2850:
example on the right, where the '*)' implements the default case as a
2201:
true = λx. λy. x false = λx. λy. y ifThenElse = (λc. λx. λy. (c x y))
1509:// This variant will not compile because 1 and () have different types 105:
are imperative constructs executed for side-effect, while conditional
4374: 2220:
arguments to their preferred single argument, which is then returned.
3572: 3326:, it is idiomatic to use them to implement conditional assignment. 3622: 3152: 780: 663: 312: 274: 37: 29: 716:...) can follow a conditional without being enclosed in a block. 3879: 3315: 1711:
Where e is any numeric expression (not necessarily an integer).
1075:
condition ? evaluated-when-true : evaluated-when-false
631: 287: 2212:
false takes up to two arguments and once both are provided(see
2205:
true takes up to two arguments and once both are provided (see
4138: 4088: 3904: 3319: 1319: 1313: 1299: 1068: 820:– the first of which was inspired to a great extent by ALGOL: 623: 2458:
The code above with multivariable functions looks like this:
1464:// Assign my_variable some value, depending on the value of x 981:, as ordinary expressions; the lazy evaluation means that an 4458:
works like a switch statement. For details and examples see
1325:
is not a keyword but a function (in Tcl known as command or
273:
In early programming languages, especially some dialects of
4740:"American National Standard Programming Language FORTRAN" 3151:
and many others. Here is a simple example written in the
1829:
is an unstructured control statement, and is not used in
1672:
This was the earliest conditional statement in Fortran.
705:, and so on. This works because in these languages, any 1119:
which can be compared to the Algol-family if–then–else
630:
keyword both for its curly brackets or colon syntaxes.
1872:
as an abstract method that takes two parameters, both
1836:
In practice it has been observed that most arithmetic
977:, it is possible to write control structures, such as 315:
family of languages, and ALGOL-like languages such as
4597:
Haskell 98 Language and Libraries: The Revised Report
3430:
An alternative to conditional branch instructions is
3343:"Enter the type of pet you want to name: " 4429: 4382: 3224:to patterns of data. Here is an example written in 184:In the example code above, the part represented by 4790:"Pythonic way to implement switch/case statements" 381:statements, classic programming languages such as 125:"if-then-else" redirects here. For the album, see 1127:) (and similar in Ruby and Scala, among others). 3216:The power of pattern matching is the ability to 1400:is actually a function it also returns a value: 4835:ECMAScript Language Specification, 5th Edition. 1267:"My variable is named 'bar'." 1246:"My variable is named 'foo'." 246:(which is usually optional), or if there is no 790:myvariable := if x > 20 then 1 else 2 4243: 1645:, the language Fortran has had an arithmetic 719:This design choice has a slight "cost". Each 8: 1926:uses if-else statements similar to those in 1297:and some other languages, a function called 4816:, Java Language Specification, 3rd Edition. 4262: 4256: 2019:The above example takes the conditional of 1856:Object-oriented implementation in Smalltalk 1719:This is equivalent to this sequence, where 3293:Pattern matching is not strictly speaking 3228:which illustrates both of these features: 606:. In Ada, the difference is that only one 4508:for another way to make execution choices 4341: 4309: 4303: 4297: 4291: 4285: 4279: 3452: 2856: 2216:), it returns the second argument given. 1542:// Values can be omitted when not needed 4549: 3310:or comparable data structures, such as 2209:), it returns the first argument given. 257:After either branch has been executed, 4332: 4326: 3135:may be seen as an alternative to both 113:, conditional expressions do not have 4765:"VisualWorks: Conditional Processing" 4514:for history and historical references 2178:"It's a three-way tie!" 1380:Such a behavior is possible by using 370:keyword is made to target a specific 299:, with programs in this style called 7: 4610:If-then-else Proposal on HaskellWiki 4466: 3298:languages in which it is available. 1063:and C-like languages have a special 3306:In programming languages that have 1896:executing the second closure only. 1864:the conditional statement is not a 1860:In contrast to other languages, in 934:; Assigns 'myvariable' to 2 389:keyword could target any preceding 4873:Conditional (computer programming) 4267:An #ELIF directive is used in the 1934:keyword and a left curly bracket. 1892:executing the first closure only, 1604:G0 → S0 â–ˇ G1 → S1 ... â–ˇ Gn → Sn 393:statement in the nest, as parsed. 25: 4479: 4866: 3220:match not only actions but also 1888:, which both define the method, 1566:"x is greater than 20" 594:language for example, is simply 374:statement preceding it, but for 4625:. Embeddedgurus.com. 2009-02-18 261:returns to the point after the 235:, the statements following the 946:Haskell (programming language) 779:and some other members of the 693:, this special syntax for the 1: 4475:is obsolescent in Fortran 90. 4368: 4362: 3446:Choice system cross reference 3286:This code defines a function 575:print (you have to pay $ 10) 567:print (you have to pay $ 20) 559:print (you have to pay $ 30) 471:is associated with the first 285:statement could only contain 4767:. 2006-12-16. Archived from 4742:. 1978-04-03. Archived from 760:Ternary conditional operator 742:...), an alternative is the 291:statements (equivalent to a 4719:"If and if let expressions" 4584:POSIX standard shell syntax 2151:"Two people won!" 2100:"One person won!" 1616:'s are the guards and the S 1415:Rust (programming language) 356:The "dangling else" problem 4911: 4850:Documentation for Ruby 3.0 4571:Visual Basic ElseIf syntax 3423: 3125: 2819: 2816:Case and switch statements 2008:"You got Tails!" 1981:"You got Heads!" 1435:by default. To ensure the 1412: 1311: 1286: 943: 757: 359: 188:constitutes a conditional 124: 4879:IF NOT (ActionScript 3.0) 4496:Branch (computer science) 3474: 3469: 3463: 3460: 3455: 1868:but defined in the class 1366:invokes a function named 650:uses the special keyword 467:depending on whether the 227:condition – for example, 174:message= order new stock 34:If-then-else flow diagram 4644:"New Control Structures" 4358:Stack Overflow question. 3328: 3230: 3157: 3060: 2952: 2880: 2617: 2460: 2324: 2236: 2037: 1936: 1898: 1725: 1723:is evaluated only once. 1679: 1584:Guarded Command Language 1461: 1331: 1192: 1132: 1081: 987: 970:in recursive functions. 871: 822: 754:If–then–else expressions 709:statement (in this case 178:message= there is stock 4501:Conditional compilation 4422:if ... else if ... else 3408:In languages that have 3302:Hash-based conditionals 1455:can always evaluate to 764:Many languages support 610:is needed, if one uses 479:. This is known as the 269:History and development 250:branch, then after the 144:form) looks like this: 64:conditional expressions 4895:Conditional constructs 4826:Ecma-international.org 4314:The often-encountered 2836:compiler optimizations 2021:Math.random() < 0.5 1831:structured programming 1114:// In C-like languages 305:structured programming 111:functional programming 68:conditional constructs 60:conditional statements 47: 35: 4669:"uplevel manual page" 2854:matching any string. 954:98, there is only an 634:provides the keyword 297:spaghetti programming 78:expression, called a 41: 33: 4875:at Wikimedia Commons 4424:, whereas a "simple 3457:Programming language 3434:. Predication is an 3376:"Meowsles" 2829:(in some languages, 1880:has two subclasses, 1594:(corresponding to a 1578:Guarded conditionals 727:chains recursively. 541:-- other statements; 150:(Boolean condition) 72:programming language 4523:Relational operator 3410:anonymous functions 3187:"coconut" 973:Because Haskell is 534:-- more statements; 186:(Boolean condition) 4846:"Pattern Matching" 4831:2015-04-12 at the 4512:McCarthy Formalism 4352:regular expression 4250:regular expression 4215:Windows PowerShell 3763:Yes, but unneeded 3426:Branch predication 3388:"Tweety" 3308:associative arrays 3202:"banana" 2852:regular expression 1866:language construct 1123:(in contrast to a 787:as an expression: 590:statement, in the 555:discount < 11% 524:-- more statements 48: 36: 4871:Media related to 4558:PHP elseif syntax 4238: 4237: 4190:Visual Basic .NET 3172:"apple" 3119: 3118: 2827:Switch statements 2466:computationResult 2330:computationResult 1627:Concurrent Pascal 417:can be parsed as 16:(Redirected from 4902: 4870: 4854: 4853: 4842: 4836: 4823: 4817: 4811: 4805: 4804: 4802: 4801: 4792:. Archived from 4786: 4780: 4779: 4777: 4776: 4761: 4755: 4754: 4752: 4751: 4736: 4730: 4729: 4727: 4725: 4715: 4709: 4708: 4706: 4704: 4694:"if manual page" 4690: 4684: 4683: 4681: 4679: 4665: 4659: 4658: 4656: 4654: 4640: 4634: 4633: 4631: 4630: 4619: 4613: 4606: 4600: 4593: 4587: 4580: 4574: 4567: 4561: 4554: 4538:Conditional move 4506:Dynamic dispatch 4483: 4474: 4470: 4457: 4456: 4453: 4450: 4447: 4444: 4441: 4438: 4435: 4432: 4427: 4423: 4419: 4418: 4415: 4412: 4409: 4406: 4403: 4400: 4397: 4394: 4391: 4388: 4385: 4380: 4372: 4366: 4349: 4345: 4336: 4330: 4317: 4313: 4307: 4301: 4295: 4289: 4283: 4266: 4260: 4247: 3476:Pattern matching 3453: 3404: 3401: 3398: 3395: 3392: 3389: 3386: 3383: 3382:"Bird" 3380: 3377: 3374: 3371: 3368: 3365: 3364:"Fido" 3362: 3359: 3356: 3353: 3350: 3347: 3344: 3341: 3338: 3335: 3332: 3282: 3279: 3276: 3273: 3270: 3267: 3264: 3261: 3258: 3255: 3252: 3249: 3246: 3243: 3240: 3237: 3234: 3212: 3209: 3206: 3203: 3200: 3197: 3194: 3191: 3188: 3185: 3182: 3179: 3176: 3173: 3170: 3167: 3164: 3161: 3145:Wolfram Language 3133:Pattern matching 3128:Pattern matching 3122:Pattern matching 3113: 3110: 3106: 3102: 3099: 3095: 3092: 3089: 3085: 3081: 3078: 3074: 3070: 3067: 3064: 3055: 3052: 3049: 3046: 3043: 3040: 3037: 3034: 3031: 3028: 3025: 3022: 3019: 3016: 3013: 3010: 3007: 3004: 3001: 2998: 2995: 2992: 2989: 2986: 2983: 2980: 2977: 2974: 2971: 2968: 2965: 2962: 2959: 2956: 2947: 2944: 2941: 2938: 2935: 2932: 2929: 2926: 2923: 2920: 2917: 2914: 2911: 2908: 2905: 2902: 2899: 2896: 2893: 2890: 2887: 2884: 2857: 2844:pattern matching 2822:Switch statement 2804: 2801: 2798: 2795: 2792: 2789: 2786: 2783: 2780: 2777: 2774: 2771: 2768: 2765: 2762: 2759: 2756: 2753: 2750: 2747: 2744: 2741: 2738: 2735: 2732: 2729: 2726: 2723: 2720: 2717: 2714: 2711: 2708: 2705: 2702: 2699: 2696: 2693: 2690: 2687: 2684: 2681: 2678: 2675: 2672: 2669: 2666: 2663: 2660: 2657: 2654: 2651: 2648: 2645: 2642: 2639: 2636: 2633: 2630: 2627: 2624: 2621: 2608: 2605: 2602: 2599: 2596: 2593: 2590: 2587: 2584: 2581: 2578: 2575: 2572: 2569: 2566: 2563: 2560: 2557: 2554: 2551: 2548: 2545: 2542: 2539: 2536: 2533: 2530: 2527: 2524: 2521: 2518: 2515: 2512: 2509: 2506: 2503: 2500: 2497: 2494: 2491: 2488: 2485: 2482: 2479: 2476: 2473: 2470: 2467: 2464: 2454: 2451: 2448: 2445: 2442: 2439: 2436: 2433: 2430: 2427: 2424: 2421: 2418: 2415: 2412: 2409: 2406: 2403: 2400: 2397: 2394: 2391: 2388: 2385: 2382: 2379: 2376: 2373: 2370: 2367: 2364: 2361: 2358: 2355: 2352: 2349: 2346: 2343: 2340: 2337: 2334: 2331: 2328: 2315: 2312: 2309: 2306: 2303: 2300: 2297: 2294: 2291: 2288: 2285: 2282: 2279: 2276: 2273: 2270: 2267: 2264: 2261: 2258: 2255: 2252: 2249: 2246: 2243: 2240: 2185: 2182: 2179: 2176: 2173: 2170: 2167: 2164: 2161: 2158: 2155: 2152: 2149: 2146: 2143: 2140: 2137: 2134: 2131: 2128: 2125: 2122: 2119: 2116: 2113: 2110: 2107: 2104: 2101: 2098: 2095: 2092: 2089: 2086: 2083: 2080: 2077: 2074: 2071: 2068: 2065: 2062: 2059: 2056: 2053: 2050: 2047: 2044: 2041: 2034: 2030: 2026: 2022: 2015: 2012: 2009: 2006: 2003: 2000: 1997: 1994: 1991: 1988: 1985: 1982: 1979: 1976: 1973: 1970: 1967: 1964: 1961: 1958: 1955: 1952: 1949: 1946: 1943: 1940: 1914: 1911: 1908: 1905: 1902: 1895: 1891: 1887: 1883: 1879: 1871: 1839: 1816: 1813: 1810: 1807: 1804: 1801: 1798: 1795: 1792: 1789: 1786: 1783: 1780: 1777: 1774: 1771: 1768: 1765: 1762: 1759: 1756: 1753: 1750: 1747: 1744: 1741: 1738: 1735: 1732: 1729: 1707: 1704: 1701: 1698: 1695: 1692: 1689: 1686: 1683: 1671: 1665: 1659: 1573: 1570: 1567: 1564: 1561: 1558: 1555: 1552: 1549: 1546: 1543: 1540: 1537: 1534: 1531: 1528: 1525: 1522: 1519: 1516: 1513: 1510: 1507: 1504: 1501: 1498: 1495: 1492: 1489: 1486: 1483: 1480: 1477: 1474: 1471: 1468: 1465: 1458: 1454: 1450: 1446: 1442: 1438: 1434: 1430: 1426: 1399: 1387: 1383: 1376: 1369: 1362: 1359: 1358:"Foo!" 1356: 1353: 1350: 1347: 1344: 1341: 1338: 1335: 1328: 1324: 1302: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1250: 1247: 1244: 1241: 1238: 1235: 1232: 1229: 1226: 1223: 1220: 1217: 1214: 1211: 1208: 1205: 1202: 1199: 1196: 1178: 1175: 1172: 1169: 1166: 1163: 1160: 1157: 1154: 1151: 1148: 1145: 1142: 1139: 1136: 1115: 1112: 1109: 1106: 1103: 1100: 1097: 1094: 1091: 1088: 1085: 1076: 1065:ternary operator 1056:C-like languages 1051: 1048: 1045: 1042: 1039: 1036: 1033: 1030: 1027: 1024: 1021: 1018: 1015: 1012: 1009: 1006: 1003: 1000: 997: 994: 991: 968:pattern matching 965: 935: 932: 929: 926: 923: 920: 917: 914: 911: 908: 905: 902: 899: 896: 893: 890: 887: 884: 881: 878: 875: 868: 865: 862: 859: 856: 853: 850: 847: 844: 841: 838: 835: 832: 829: 826: 819: 804: 786: 749: 744:switch statement 741: 737: 733: 726: 722: 715: 696: 673: 661: 657: 653: 645: 641: 637: 629: 621: 617: 613: 609: 605: 601: 589: 571:discount<31% 563:discount<21% 502: 490: 486: 478: 474: 470: 392: 388: 380: 373: 369: 335: 330: 326: 310: 303:. As a result, 290: 284: 264: 253: 249: 242: 238: 234: 230: 222: 207: 203: 199: 195: 139: 135: 87:dynamic dispatch 52:computer science 21: 4910: 4909: 4905: 4904: 4903: 4901: 4900: 4899: 4885: 4884: 4863: 4858: 4857: 4844: 4843: 4839: 4833:Wayback Machine 4824: 4820: 4812: 4808: 4799: 4797: 4788: 4787: 4783: 4774: 4772: 4763: 4762: 4758: 4749: 4747: 4738: 4737: 4733: 4723: 4721: 4717: 4716: 4712: 4702: 4700: 4692: 4691: 4687: 4677: 4675: 4667: 4666: 4662: 4652: 4650: 4642: 4641: 4637: 4628: 4626: 4621: 4620: 4616: 4607: 4603: 4594: 4590: 4581: 4577: 4568: 4564: 4555: 4551: 4546: 4533:Yoda conditions 4518:Named condition 4492: 4487: 4478: 4472: 4465: 4454: 4451: 4448: 4445: 4442: 4439: 4436: 4433: 4430: 4425: 4421: 4416: 4413: 4410: 4407: 4404: 4401: 4398: 4395: 4392: 4389: 4386: 4383: 4378: 4367: 4361: 4347: 4340: 4331: 4325: 4315: 4308: 4302: 4296: 4290: 4284: 4278: 4261: 4255: 4242: 3448: 3428: 3422: 3406: 3405: 3402: 3399: 3396: 3393: 3390: 3387: 3384: 3381: 3378: 3375: 3372: 3370:"Cat" 3369: 3366: 3363: 3360: 3358:"Dog" 3357: 3354: 3351: 3348: 3345: 3342: 3339: 3336: 3333: 3330: 3304: 3284: 3283: 3280: 3277: 3274: 3271: 3268: 3265: 3262: 3259: 3256: 3253: 3250: 3247: 3244: 3241: 3238: 3235: 3232: 3214: 3213: 3210: 3207: 3204: 3201: 3198: 3195: 3192: 3189: 3186: 3183: 3180: 3177: 3174: 3171: 3168: 3165: 3162: 3159: 3130: 3124: 3115: 3114: 3111: 3108: 3107:actionOnNoMatch 3104: 3100: 3097: 3093: 3090: 3087: 3083: 3079: 3076: 3072: 3068: 3065: 3062: 3057: 3056: 3053: 3050: 3048:actionOnNoMatch 3047: 3044: 3041: 3038: 3035: 3032: 3029: 3026: 3023: 3020: 3017: 3014: 3011: 3008: 3005: 3002: 2999: 2996: 2993: 2990: 2987: 2984: 2981: 2978: 2975: 2972: 2969: 2966: 2963: 2960: 2957: 2954: 2949: 2948: 2945: 2942: 2939: 2937:actionOnNoMatch 2936: 2933: 2930: 2927: 2924: 2921: 2918: 2915: 2912: 2909: 2906: 2903: 2900: 2897: 2894: 2891: 2888: 2885: 2882: 2831:case statements 2824: 2818: 2806: 2805: 2802: 2799: 2796: 2793: 2790: 2787: 2784: 2781: 2778: 2775: 2772: 2769: 2766: 2763: 2760: 2757: 2754: 2751: 2748: 2745: 2742: 2739: 2736: 2733: 2730: 2727: 2724: 2721: 2718: 2715: 2712: 2709: 2706: 2703: 2700: 2697: 2694: 2691: 2688: 2685: 2682: 2679: 2676: 2673: 2670: 2667: 2664: 2661: 2658: 2655: 2652: 2649: 2646: 2643: 2640: 2637: 2634: 2631: 2628: 2625: 2622: 2619: 2610: 2609: 2606: 2603: 2600: 2597: 2594: 2591: 2588: 2585: 2582: 2579: 2576: 2573: 2570: 2567: 2564: 2561: 2558: 2555: 2552: 2549: 2546: 2543: 2540: 2537: 2534: 2531: 2528: 2525: 2522: 2519: 2516: 2513: 2510: 2507: 2504: 2501: 2498: 2495: 2492: 2489: 2486: 2483: 2480: 2477: 2474: 2471: 2468: 2465: 2462: 2456: 2455: 2452: 2449: 2446: 2443: 2440: 2437: 2434: 2431: 2428: 2425: 2422: 2419: 2416: 2413: 2410: 2407: 2404: 2401: 2398: 2395: 2392: 2389: 2386: 2383: 2380: 2377: 2374: 2371: 2368: 2365: 2362: 2359: 2356: 2353: 2350: 2347: 2344: 2341: 2338: 2335: 2332: 2329: 2326: 2317: 2316: 2313: 2310: 2307: 2304: 2301: 2298: 2295: 2292: 2289: 2286: 2283: 2280: 2277: 2274: 2271: 2268: 2265: 2262: 2259: 2256: 2253: 2250: 2247: 2244: 2241: 2238: 2202: 2196:Lambda calculus 2192: 2190:Lambda calculus 2187: 2186: 2183: 2180: 2177: 2174: 2171: 2168: 2165: 2162: 2159: 2156: 2153: 2150: 2147: 2144: 2141: 2138: 2135: 2132: 2129: 2126: 2123: 2120: 2117: 2114: 2111: 2108: 2105: 2102: 2099: 2096: 2093: 2090: 2087: 2084: 2081: 2078: 2075: 2072: 2069: 2066: 2063: 2060: 2057: 2054: 2051: 2048: 2045: 2042: 2039: 2032: 2028: 2024: 2020: 2017: 2016: 2013: 2010: 2007: 2004: 2001: 1998: 1995: 1992: 1989: 1986: 1983: 1980: 1977: 1974: 1971: 1968: 1965: 1962: 1959: 1956: 1953: 1950: 1947: 1944: 1941: 1938: 1921: 1916: 1915: 1912: 1909: 1906: 1903: 1900: 1893: 1889: 1885: 1881: 1877: 1869: 1858: 1837: 1823: 1818: 1817: 1814: 1811: 1808: 1805: 1802: 1799: 1796: 1793: 1790: 1787: 1784: 1781: 1778: 1775: 1772: 1769: 1766: 1763: 1760: 1757: 1754: 1751: 1748: 1745: 1742: 1739: 1736: 1733: 1730: 1727: 1717: 1709: 1708: 1705: 1702: 1699: 1696: 1693: 1690: 1687: 1684: 1681: 1678: 1666: 1660: 1654: 1639: 1621: 1615: 1608: 1588:Edsger Dijkstra 1580: 1575: 1574: 1571: 1568: 1565: 1562: 1559: 1556: 1553: 1550: 1547: 1544: 1541: 1538: 1535: 1532: 1529: 1526: 1523: 1520: 1517: 1514: 1511: 1508: 1505: 1502: 1499: 1496: 1493: 1490: 1487: 1484: 1481: 1478: 1475: 1472: 1469: 1466: 1463: 1456: 1452: 1448: 1444: 1440: 1436: 1432: 1428: 1424: 1417: 1411: 1397: 1385: 1381: 1374: 1367: 1364: 1363: 1360: 1357: 1354: 1351: 1348: 1345: 1342: 1339: 1336: 1333: 1329:). For example 1326: 1322: 1316: 1310: 1298: 1291: 1285: 1276: 1275: 1272: 1269: 1266: 1263: 1260: 1257: 1254: 1251: 1248: 1245: 1242: 1239: 1236: 1233: 1230: 1227: 1224: 1221: 1218: 1215: 1212: 1209: 1206: 1203: 1200: 1197: 1194: 1191: 1180: 1179: 1176: 1174:"bar" 1173: 1170: 1167: 1164: 1161: 1159:"foo" 1158: 1155: 1152: 1149: 1146: 1143: 1140: 1137: 1134: 1117: 1116: 1113: 1110: 1108:"bar" 1107: 1104: 1102:"foo" 1101: 1098: 1095: 1092: 1089: 1086: 1083: 1077: 1074: 1058: 1053: 1052: 1049: 1046: 1043: 1040: 1037: 1034: 1031: 1028: 1025: 1022: 1019: 1016: 1013: 1010: 1007: 1004: 1001: 998: 995: 992: 989: 963: 948: 942: 937: 936: 933: 930: 927: 924: 921: 918: 915: 912: 909: 906: 903: 900: 897: 894: 891: 888: 885: 882: 879: 876: 873: 870: 869: 866: 863: 860: 857: 854: 851: 848: 845: 842: 839: 836: 833: 830: 827: 824: 817: 802: 798:In dialects of 796: 791: 784: 774: 762: 756: 747: 739: 735: 731: 724: 720: 710: 694: 671: 659: 655: 651: 643: 639: 635: 627: 619: 615: 611: 607: 603: 599: 596:syntactic sugar 587: 580: 547: 500: 497: 488: 484: 476: 472: 468: 465: 440: 415: 390: 386: 378: 371: 367: 364: 358: 333: 328: 324: 308: 286: 282: 271: 262: 251: 247: 240: 236: 232: 228: 223:, it expects a 220: 205: 201: 197: 193: 182: 162: 137: 133: 130: 123: 99: 28: 23: 22: 15: 12: 11: 5: 4908: 4906: 4898: 4897: 4887: 4886: 4883: 4882: 4876: 4862: 4861:External links 4859: 4856: 4855: 4837: 4818: 4806: 4781: 4756: 4731: 4710: 4685: 4660: 4635: 4614: 4601: 4588: 4575: 4562: 4548: 4547: 4545: 4542: 4541: 4540: 4535: 4530: 4525: 4520: 4515: 4509: 4503: 4498: 4491: 4488: 4486: 4485: 4476: 4463: 4428:" expression: 4377:. A "searched 4359: 4338: 4323: 4276: 4253: 4239: 4236: 4235: 4232: 4229: 4226: 4223: 4220: 4217: 4211: 4210: 4207: 4204: 4201: 4198: 4195: 4192: 4186: 4185: 4182: 4179: 4176: 4173: 4170: 4167: 4160: 4159: 4156: 4153: 4150: 4147: 4144: 4141: 4135: 4134: 4131: 4128: 4125: 4122: 4119: 4116: 4110: 4109: 4106: 4103: 4100: 4097: 4094: 4091: 4085: 4084: 4081: 4078: 4075: 4072: 4069: 4066: 4060: 4059: 4056: 4053: 4050: 4047: 4044: 4041: 4035: 4034: 4031: 4028: 4025: 4022: 4019: 4016: 4010: 4009: 4006: 4003: 4000: 3997: 3994: 3991: 3985: 3984: 3981: 3978: 3975: 3972: 3969: 3966: 3960: 3959: 3956: 3953: 3950: 3947: 3944: 3941: 3926: 3925: 3922: 3919: 3916: 3913: 3910: 3907: 3901: 3900: 3897: 3894: 3891: 3888: 3885: 3882: 3876: 3875: 3872: 3869: 3866: 3863: 3860: 3857: 3851: 3850: 3847: 3844: 3841: 3838: 3835: 3832: 3826: 3825: 3822: 3819: 3816: 3813: 3810: 3807: 3796: 3795: 3792: 3789: 3786: 3783: 3780: 3777: 3771: 3770: 3767: 3764: 3761: 3758: 3755: 3752: 3746: 3745: 3742: 3739: 3736: 3733: 3730: 3727: 3721: 3720: 3717: 3714: 3711: 3708: 3705: 3702: 3696: 3695: 3692: 3689: 3686: 3683: 3680: 3677: 3671: 3670: 3667: 3664: 3659: 3656: 3653: 3650: 3644: 3643: 3640: 3637: 3634: 3631: 3628: 3625: 3619: 3618: 3615: 3612: 3609: 3606: 3603: 3600: 3594: 3593: 3590: 3587: 3584: 3581: 3578: 3575: 3565: 3564: 3561: 3558: 3555: 3552: 3549: 3546: 3540: 3539: 3536: 3533: 3530: 3527: 3524: 3521: 3515: 3514: 3511: 3508: 3505: 3502: 3499: 3496: 3490: 3489: 3486: 3483: 3479: 3478: 3473: 3468: 3462: 3461:Structured if 3459: 3447: 3444: 3424:Main article: 3421: 3418: 3414:dispatch table 3329: 3303: 3300: 3231: 3158: 3126:Main article: 3123: 3120: 3117: 3116: 3061: 3058: 2953: 2950: 2881: 2877: 2876: 2870: 2864: 2820:Main article: 2817: 2814: 2749:λSecondBranch. 2656:λSecondBranch. 2618: 2461: 2325: 2237: 2222: 2221: 2217: 2210: 2200: 2191: 2188: 2038: 2033:You got Tails! 2029:You got Heads! 2023:which outputs 1937: 1920: 1917: 1899: 1857: 1854: 1822: 1819: 1726: 1716: 1713: 1680: 1677: 1674: 1638: 1635: 1617: 1611: 1600: 1579: 1576: 1462: 1413:Main article: 1410: 1407: 1406: 1405: 1394: 1393: 1332: 1312:Main article: 1309: 1306: 1287:Main article: 1284: 1281: 1193: 1190: 1185: 1133: 1082: 1073: 1057: 1054: 988: 944:Main article: 941: 938: 874:;; Common Lisp 872: 823: 795: 792: 789: 773: 770: 766:if expressions 755: 752: 551: 505: 496: 493: 444: 419: 395: 360:Main article: 357: 354: 327:statements in 301:spaghetti code 279:home computers 270: 267: 166: 158:(alternative) 146: 122: 121:If–then(–else) 119: 98: 95: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 4907: 4896: 4893: 4892: 4890: 4880: 4877: 4874: 4869: 4865: 4864: 4860: 4851: 4847: 4841: 4838: 4834: 4830: 4827: 4822: 4819: 4815: 4810: 4807: 4796:on 2015-01-20 4795: 4791: 4785: 4782: 4771:on 2007-10-22 4770: 4766: 4760: 4757: 4746:on 2007-10-11 4745: 4741: 4735: 4732: 4720: 4714: 4711: 4699: 4695: 4689: 4686: 4674: 4670: 4664: 4661: 4649: 4645: 4639: 4636: 4624: 4618: 4615: 4611: 4605: 4602: 4599: 4598: 4592: 4589: 4586: 4585: 4579: 4576: 4573: 4572: 4566: 4563: 4560: 4559: 4553: 4550: 4543: 4539: 4536: 4534: 4531: 4529: 4526: 4524: 4521: 4519: 4516: 4513: 4510: 4507: 4504: 4502: 4499: 4497: 4494: 4493: 4489: 4482: 4481: 4477: 4469: 4468: 4464: 4461: 4381:" expression 4376: 4371: 4370: 4365: 4364: 4360: 4357: 4353: 4344: 4343: 4339: 4335: 4334: 4329: 4328: 4324: 4321: 4312: 4311: 4306: 4305: 4300: 4299: 4294: 4293: 4288: 4287: 4282: 4281: 4277: 4274: 4270: 4265: 4264: 4259: 4258: 4254: 4251: 4246: 4245: 4241: 4240: 4233: 4230: 4228:Fall-through 4227: 4224: 4221: 4218: 4216: 4213: 4212: 4208: 4205: 4202: 4199: 4196: 4193: 4191: 4188: 4187: 4183: 4180: 4177: 4174: 4171: 4168: 4165: 4162: 4161: 4157: 4154: 4151: 4148: 4145: 4142: 4140: 4137: 4136: 4132: 4129: 4126: 4123: 4120: 4117: 4115: 4112: 4111: 4107: 4104: 4101: 4098: 4095: 4092: 4090: 4087: 4086: 4082: 4079: 4077:Fall-through 4076: 4073: 4070: 4067: 4065: 4062: 4061: 4057: 4054: 4051: 4048: 4045: 4042: 4040: 4037: 4036: 4032: 4029: 4026: 4023: 4020: 4017: 4015: 4012: 4011: 4007: 4004: 4001: 3998: 3995: 3992: 3990: 3987: 3986: 3982: 3979: 3976: 3973: 3970: 3967: 3965: 3962: 3961: 3957: 3954: 3951: 3948: 3945: 3942: 3939: 3935: 3934:Object Pascal 3931: 3928: 3927: 3923: 3920: 3918:Fall-through 3917: 3914: 3911: 3908: 3906: 3903: 3902: 3898: 3895: 3892: 3889: 3886: 3883: 3881: 3878: 3877: 3873: 3870: 3867: 3864: 3861: 3858: 3856: 3853: 3852: 3848: 3845: 3842: 3839: 3836: 3833: 3831: 3828: 3827: 3823: 3820: 3818:Fall-through 3817: 3814: 3811: 3808: 3805: 3801: 3798: 3797: 3793: 3790: 3788:Fall-through 3787: 3784: 3781: 3778: 3776: 3773: 3772: 3768: 3765: 3762: 3759: 3756: 3753: 3751: 3748: 3747: 3743: 3740: 3737: 3734: 3731: 3728: 3726: 3723: 3722: 3718: 3715: 3712: 3709: 3706: 3703: 3701: 3698: 3697: 3693: 3690: 3687: 3684: 3681: 3678: 3676: 3673: 3672: 3668: 3665: 3663: 3660: 3657: 3654: 3651: 3649: 3646: 3645: 3641: 3638: 3635: 3632: 3629: 3626: 3624: 3621: 3620: 3616: 3613: 3610: 3607: 3604: 3601: 3599: 3596: 3595: 3591: 3588: 3586:Fall-through 3585: 3582: 3579: 3576: 3574: 3570: 3567: 3566: 3562: 3559: 3556: 3553: 3550: 3547: 3545: 3542: 3541: 3537: 3534: 3531: 3528: 3525: 3522: 3520: 3517: 3516: 3512: 3509: 3506: 3503: 3500: 3497: 3495: 3492: 3491: 3487: 3484: 3481: 3480: 3477: 3472: 3471:Arithmetic if 3467:–select–case 3466: 3458: 3454: 3451: 3445: 3443: 3441: 3437: 3436:architectural 3433: 3427: 3419: 3417: 3415: 3411: 3327: 3325: 3321: 3317: 3313: 3309: 3301: 3299: 3296: 3291: 3289: 3229: 3227: 3223: 3219: 3156: 3154: 3150: 3146: 3142: 3138: 3134: 3129: 3121: 3096:actionOnYandZ 3059: 3030:actionOnYandZ 2951: 2928:actionOnYandZ 2879: 2878: 2874: 2871: 2868: 2865: 2862: 2859: 2858: 2855: 2853: 2849: 2845: 2841: 2840:lookup tables 2837: 2832: 2828: 2823: 2815: 2813: 2809: 2737:λFirstBranch. 2644:λFirstBranch. 2616: 2613: 2459: 2323: 2320: 2235: 2232: 2230: 2226: 2218: 2215: 2211: 2208: 2204: 2203: 2199: 2197: 2189: 2036: 1935: 1933: 1929: 1925: 1918: 1897: 1875: 1867: 1863: 1855: 1853: 1851: 1846: 1841: 1834: 1832: 1828: 1820: 1724: 1722: 1714: 1712: 1675: 1673: 1669: 1663: 1657: 1652: 1648: 1644: 1637:Arithmetic if 1636: 1634: 1632: 1628: 1623: 1620: 1614: 1607: 1603: 1599: 1597: 1593: 1589: 1585: 1577: 1460: 1447:, because an 1422: 1416: 1408: 1403: 1402: 1401: 1391: 1390: 1389: 1378: 1371: 1330: 1321: 1315: 1307: 1305: 1301: 1296: 1290: 1282: 1280: 1189: 1186: 1184: 1131: 1128: 1126: 1122: 1080: 1072: 1070: 1066: 1062: 1055: 986: 984: 980: 976: 971: 969: 961: 957: 956:if expression 953: 947: 939: 821: 816: 812: 808: 801: 794:Lisp dialects 793: 788: 783:family allow 782: 778: 771: 769: 767: 761: 753: 751: 745: 728: 717: 714: 708: 704: 700: 692: 688: 684: 680: 675: 669: 665: 649: 633: 625: 597: 593: 584: 578: 574: 570: 566: 562: 558: 554: 550: 545: 542: 539: 535: 532: 528: 525: 522: 518: 515: 514:-- statements 512: 508: 504: 494: 492: 487:statement or 482: 481:dangling else 463: 459: 455: 451: 447: 443: 438: 434: 430: 426: 422: 418: 413: 409: 405: 402: 398: 394: 384: 377: 363: 362:Dangling else 355: 353: 351: 347: 343: 339: 322: 318: 314: 306: 302: 298: 294: 289: 280: 277:in the 1980s 276: 268: 266: 260: 255: 245: 226: 218: 213: 211: 191: 187: 181: 177: 173: 169: 165: 164:For example: 161: 157: 154:(consequent) 153: 149: 145: 143: 128: 120: 118: 116: 112: 108: 104: 96: 94: 92: 88: 83: 81: 77: 73: 69: 65: 61: 57: 53: 45: 40: 32: 19: 4849: 4840: 4821: 4814:Java.sun.com 4809: 4798:. Retrieved 4794:the original 4784: 4773:. Retrieved 4769:the original 4759: 4748:. Retrieved 4744:the original 4734: 4722:. Retrieved 4713: 4701:. Retrieved 4688: 4676:. Retrieved 4663: 4651:. Retrieved 4648:Tcler's wiki 4638: 4627:. Retrieved 4617: 4604: 4595: 4591: 4582: 4578: 4569: 4565: 4556: 4552: 4480: 4467: 4369: 4363: 4342: 4333: 4327: 4320:if then else 4319: 4310: 4304: 4298: 4292: 4286: 4280: 4275:other files. 4269:preprocessor 4263: 4257: 4244: 4164:Visual Basic 3449: 3440:control flow 3429: 3407: 3305: 3294: 3292: 3287: 3285: 3221: 3217: 3215: 3140: 3137:if–then–else 3136: 3131: 2873:Shell script 2848:shell script 2846:, as in the 2830: 2825: 2810: 2807: 2752:SecondBranch 2722:λifThenElse. 2659:SecondBranch 2629:λifThenElse. 2614: 2611: 2457: 2321: 2318: 2248:λifThenElse. 2233: 2228: 2224: 2223: 2193: 2018: 1931: 1922: 1859: 1849: 1842: 1835: 1826: 1824: 1720: 1718: 1710: 1667: 1661: 1655: 1650: 1646: 1640: 1624: 1618: 1612: 1609: 1605: 1601: 1595: 1581: 1459:by default. 1418: 1395: 1379: 1372: 1365: 1317: 1295:Visual Basic 1292: 1289:Visual Basic 1283:Visual Basic 1277: 1181: 1129: 1124: 1120: 1118: 1078: 1059: 982: 978: 972: 960:if statement 959: 955: 949: 797: 785:if–then–else 775: 772:Algol family 765: 763: 750:statements. 729: 718: 712: 706: 676: 668:Visual Basic 646:statements. 618:followed by 602:followed by 585: 581: 576: 572: 568: 564: 560: 556: 552: 548: 543: 540: 537: 533: 530: 526: 523: 520: 516: 513: 510: 506: 498: 466: 461: 457: 453: 449: 445: 441: 436: 432: 428: 424: 420: 416: 411: 407: 403: 400: 396: 365: 350:Visual Basic 334:if–then–else 300: 272: 256: 214: 209: 189: 185: 183: 179: 175: 171: 167: 163: 159: 155: 151: 147: 138:if–then–else 131: 127:If Then Else 115:side-effects 101:Conditional 100: 84: 79: 67: 63: 59: 56:conditionals 55: 49: 46:flow diagram 44:if–then–else 43: 18:If statement 4724:November 1, 4528:Test (Unix) 4471:Arithmetic 4420:works like 4350:construct, 3830:Mathematica 3432:predication 3420:Predication 3324:Objective-C 3196:dango_mochi 3024:'z' 3015:'y' 2994:'x' 2973:'a' 2922:'z' 2916:'y' 2904:'x' 2892:'a' 2740:FirstBranch 2647:FirstBranch 2496:_ifThenElse 2487:_ifThenElse 2357:_ifThenElse 2351:_ifThenElse 1825:Arithmetic 1515:my_variable 1470:my_variable 1451:without an 1188:Small Basic 1168:my_variable 1153:my_variable 1121:expressions 1084:my_variable 983:if function 815:Common Lisp 740:else if x=2 736:else if x=1 614:instead of 491:brackets). 217:interpreter 107:expressions 97:Terminology 4800:2015-01-19 4775:2007-09-09 4750:2007-09-09 4703:August 21, 4698:www.tcl.tk 4678:August 21, 4673:www.tcl.tk 4653:August 21, 4629:2012-09-07 4544:References 4460:Case (SQL) 4346:In a Ruby 4166:, classic 3989:QuickBASIC 3804:JavaScript 3800:ECMAScript 3700:Fortran 90 3544:Bash shell 3403:known_pets 3349:known_pets 3155:language: 3066:$ someChar 2838:, such as 2728:ifThenElse 2635:ifThenElse 2254:ifThenElse 1924:JavaScript 1919:JavaScript 1821:Stylistics 1643:Fortran 77 1388:commands: 1304:function. 1255:TextWindow 1234:TextWindow 1207:ReadNumber 1201:TextWindow 962:, and the 901:myvariable 834:myvariable 758:See also: 703:ECMAScript 666:, such as 529:condition 519:condition 509:condition 475:or second 346:JavaScript 190:expression 142:pseudocode 103:statements 58:(that is, 4074:Unneeded 4052:Unneeded 3949:Unneeded 3815:Unneeded 3785:Unneeded 3760:Unneeded 3735:Unneeded 3688:Unneeded 3633:Unneeded 3627:Unneeded 3608:Unneeded 3583:Unneeded 3218:concisely 3086:actionOnX 3075:actionOnA 3000:actionOnX 2979:actionOnA 2910:actionOnX 2898:actionOnA 2229:necessary 1907:condition 1862:Smalltalk 1850:once only 1715:Semantics 1596:condition 1586:(GCL) of 1261:WriteLine 1240:WriteLine 1125:statement 825:;; Scheme 626:uses the 499:By using 219:finds an 210:statement 80:condition 42:A nested 4889:Category 4829:Archived 4490:See also 4452:exprDflt 4414:exprDflt 4252:support. 3488:else–if 2961:someChar 2886:someChar 2214:currying 2207:currying 1913:ifFalse: 1874:closures 1560:println! 1396:Because 1279:screen. 777:ALGOL 60 383:ALGOL 60 321:Modula-2 229:x > 0 215:When an 170:stock=0 4316:else if 4273:include 3757:Needed 3750:Haskell 3397:my_name 3226:Haskell 3042:default 2719:λfalse. 2626:λfalse. 2245:λfalse. 2166:console 2139:console 2088:console 1996:console 1969:console 1910:ifTrue: 1878:Boolean 1870:Boolean 1845:IBM 704 1670:> 0. 1658:< 0, 1382:uplevel 1035:if' 1017:if' 990:if' 952:Haskell 940:Haskell 748:else if 725:else if 721:else if 695:else if 501:else if 495:Else if 391:if–then 379:if–then 372:if–then 329:if–then 283:if–then 259:control 225:Boolean 134:if–then 91:runtime 76:Boolean 4375:SQL-92 3964:Python 3938:Delphi 3930:Pascal 3855:Oberon 3648:Eiffel 3465:switch 3312:Python 3295:always 3222:values 3139:, and 2955:switch 2861:Pascal 2812:page. 2716:λtrue. 2623:λtrue. 2481:_false 2345:_false 2242:λtrue. 2055:random 1951:random 1815:label3 1785:label2 1755:label1 1706:label3 1700:label2 1694:label1 1676:Syntax 1641:Up to 831:define 818:  811:Racket 807:Scheme 803:  732:if x=0 707:single 683:Pascal 679:Simula 672:ElseIf 670:, use 648:Python 628:elseif 612:elseif 608:end if 588:elseif 577:end if 569:elseif 561:elseif 544:end if 527:elseif 517:elseif 485:end if 376:nested 317:Pascal 293:branch 263:end If 252:end If 180:End If 160:End If 70:) are 4881:video 4446:expr1 4408:expr2 4402:cond2 4396:expr1 4390:cond1 4114:Swift 4064:Scala 3623:COBOL 3485:else 3482:then 3337:input 3205:-> 3190:-> 3175:-> 3163:fruit 3160:match 3153:OCaml 3036:break 3006:break 2985:break 2731:false 2589:=> 2559:=> 2535:=> 2502:_true 2493:=> 2475:_true 2435:=> 2429:=> 2423:=> 2411:=> 2405:=> 2393:=> 2387:=> 2363:_true 2354:=> 2348:=> 2342:=> 2339:_true 1894:False 1886:False 1631:occam 1610:the G 1592:guard 1273:EndIf 1038:False 1011:-> 1005:-> 999:-> 958:, no 781:ALGOL 664:BASIC 636:elsif 489:{...} 313:ALGOL 281:, an 275:BASIC 244:block 198:False 4726:2020 4705:2020 4680:2020 4655:2020 4449:ELSE 4443:THEN 4440:val1 4437:WHEN 4434:expr 4431:CASE 4426:CASE 4411:ELSE 4405:THEN 4399:WHEN 4393:THEN 4387:WHEN 4384:CASE 4379:CASE 4356:this 4348:case 4225:Yes 4222:Yes 4203:Yes 4200:Yes 4197:Yes 4194:Yes 4178:Yes 4175:Yes 4172:Yes 4169:Yes 4158:Yes 4152:Yes 4149:Yes 4146:Yes 4133:Yes 4127:Yes 4124:Yes 4121:Yes 4102:Yes 4099:Yes 4096:Yes 4093:Yes 4083:Yes 4071:Yes 4058:Yes 4049:Yes 4046:Yes 4039:Rust 4033:Yes 4027:Yes 4024:Yes 4021:Yes 4018:Yes 4014:Ruby 4002:Yes 3999:Yes 3996:Yes 3993:Yes 3983:Yes 3974:Yes 3971:Yes 3952:Yes 3946:Yes 3943:Yes 3915:Yes 3912:Yes 3893:Yes 3890:Yes 3887:Yes 3880:Perl 3868:Yes 3865:Yes 3862:Yes 3859:Yes 3849:Yes 3843:Yes 3840:Yes 3837:Yes 3812:Yes 3782:Yes 3775:Java 3769:Yes 3754:Yes 3738:Yes 3732:Yes 3716:Yes 3713:Yes 3710:Yes 3707:Yes 3704:Yes 3694:Yes 3685:Yes 3682:Yes 3679:Yes 3658:Yes 3655:Yes 3652:Yes 3636:Yes 3630:Yes 3611:Yes 3605:Yes 3580:Yes 3563:Yes 3557:Yes 3554:Yes 3551:Yes 3548:Yes 3532:Yes 3529:Yes 3526:Yes 3507:Yes 3504:Yes 3501:Yes 3498:Yes 3316:Perl 3193:cook 3178:cook 3166:with 3141:case 3112:esac 3063:case 3021:case 3012:case 2991:case 2970:case 2934:else 2883:case 2638:true 2453:))); 2257:true 2225:note 2160:else 2121:< 2109:else 2070:< 2049:Math 2025:true 1990:else 1957:< 1945:Math 1890:True 1884:and 1882:True 1812:GOTO 1782:GOTO 1752:GOTO 1664:= 0, 1629:and 1582:The 1551:> 1527:> 1497:else 1482:> 1453:else 1441:else 1421:Rust 1409:Rust 1386:expr 1384:and 1355:puts 1343:> 1327:proc 1252:Else 1231:Then 1222:> 1165:else 1144:> 1093:> 1020:True 996:Bool 975:lazy 964:else 913:> 898:setq 846:> 813:and 800:Lisp 738:... 734:... 713:cond 699:Java 689:and 687:BCPL 658:and 656:else 652:elif 644:else 642:and 632:Perl 616:else 600:else 598:for 586:The 573:then 565:then 557:then 538:else 536:... 531:then 521:then 511:then 469:else 464:s2) 462:else 458:then 450:then 437:else 433:then 425:then 412:else 408:then 401:then 387:else 368:else 366:The 348:and 342:Java 325:GOTO 319:and 288:GOTO 248:else 241:else 237:then 233:true 206:Then 204:and 194:True 176:Else 172:Then 156:Else 152:Then 132:The 66:and 4455:END 4417:END 4234:No 4231:No 4219:No 4209:No 4206:No 4184:No 4181:No 4155:No 4143:No 4139:Tcl 4130:No 4118:No 4108:No 4105:No 4089:SQL 4080:No 4068:No 4055:No 4043:No 4030:No 4008:No 4005:No 3980:No 3977:No 3968:No 3958:No 3955:No 3924:No 3921:No 3909:No 3905:PHP 3899:No 3896:No 3884:No 3874:No 3871:No 3846:No 3834:No 3824:No 3821:No 3809:No 3794:No 3791:No 3779:No 3766:No 3744:No 3741:No 3729:No 3719:No 3691:No 3669:No 3666:No 3662:Yes 3642:No 3639:No 3617:No 3614:No 3602:No 3592:No 3589:No 3577:No 3573:C++ 3560:No 3538:No 3535:No 3523:No 3519:APL 3513:No 3510:No 3494:Ada 3331:pet 3322:or 3320:PHP 3288:map 3275:map 3242:map 3233:map 3208:mix 3181:pie 2943:end 2791:λr. 2788:λl. 2785:λc. 2776:λy. 2773:λx. 2764:λy. 2761:λx. 2698:λr. 2695:λl. 2692:λc. 2683:λy. 2680:λx. 2671:λy. 2668:λx. 2607:)); 2520:)(( 2463:var 2327:var 2302:λr. 2299:λl. 2296:λc. 2287:λy. 2284:λx. 2275:λy. 2272:λx. 2194:In 2172:log 2145:log 2094:log 2058:(); 2040:var 2031:or 2002:log 1975:log 1960:0.5 1901:var 1653:is 1512:let 1467:let 1419:In 1340:$ x 1320:Tcl 1318:In 1314:Tcl 1308:Tcl 1300:IIf 1293:In 950:In 931:))) 880:let 711:if 624:PHP 592:Ada 442:or 439:s2 435:s) 414:s2 196:or 136:or 50:In 4891:: 4848:. 4696:. 4671:. 4646:. 4473:if 3940:) 3932:, 3806:) 3725:Go 3675:F# 3598:C# 3571:, 3442:. 3416:. 3318:, 3314:, 3211:;; 3149:ML 3147:, 3109:;; 3101:;; 3091:;; 3080:;; 3069:in 2889:of 2875:: 2869:: 2863:: 2803:)) 2782:)( 2770:)( 2758:)( 2755:)) 2713:(( 2710:)) 2689:)( 2677:)( 2665:)( 2662:)) 2620:(( 2472:(( 2447:)( 2417:)( 2399:)( 2381:)( 2372:)( 2366:)( 2336:(( 2314:)) 2293:)( 2281:)( 2269:)( 2239:(( 2181:); 2154:); 2112:if 2103:); 2061:if 2011:); 1984:); 1954:() 1939:if 1932:if 1876:. 1838:IF 1833:. 1827:if 1800:GT 1788:IF 1770:EQ 1758:IF 1740:LT 1728:IF 1682:IF 1647:if 1633:. 1606:fi 1602:if 1569:); 1554:20 1545:if 1539:}; 1530:20 1521:if 1506:}; 1485:20 1476:if 1457:() 1449:if 1445:() 1437:if 1433:() 1429:() 1425:if 1423:, 1398:if 1375:if 1368:if 1346:10 1334:if 1323:if 1225:10 1213:If 1210:() 1147:10 1135:if 1096:10 1069:?: 993::: 979:if 919:12 907:if 892:)) 889:10 883:(( 864:)) 852:12 840:if 809:, 805:– 701:, 685:, 681:, 660:if 640:if 622:. 620:if 604:if 579:; 553:if 546:; 507:if 477:if 473:if 460:s 456:b 454:if 448:a 446:if 431:b 429:if 423:a 421:if 410:s 406:b 404:if 399:a 397:if 352:. 344:, 340:, 309:if 265:. 254:. 221:If 202:If 168:If 148:If 93:. 82:. 62:, 54:, 4852:. 4803:. 4778:. 4753:. 4728:. 4707:. 4682:. 4657:. 4632:. 4612:" 4608:" 4462:. 3936:( 3802:( 3569:C 3400:= 3394:} 3391:, 3385:: 3379:, 3373:: 3367:, 3361:: 3355:{ 3352:= 3346:) 3340:( 3334:= 3281:t 3278:f 3272:: 3269:h 3266:f 3263:= 3260:) 3257:t 3254:: 3251:h 3248:( 3245:f 3239:= 3236:_ 3199:| 3184:| 3169:| 3105:) 3103:* 3098:; 3094:) 3088:; 3084:) 3082:x 3077:; 3073:) 3071:a 3054:} 3051:; 3045:: 3039:; 3033:; 3027:: 3018:: 3009:; 3003:; 2997:: 2988:; 2982:; 2976:: 2967:{ 2964:) 2958:( 2946:; 2940:; 2931:; 2925:: 2919:, 2913:; 2907:: 2901:; 2895:: 2867:C 2800:r 2797:l 2794:c 2779:y 2767:x 2746:( 2743:) 2734:( 2725:( 2707:r 2704:l 2701:c 2686:y 2674:x 2653:( 2650:) 2641:( 2632:( 2604:y 2601:, 2598:x 2595:( 2592:c 2586:) 2583:y 2580:, 2577:x 2574:, 2571:c 2568:( 2565:, 2562:y 2556:) 2553:y 2550:, 2547:x 2544:( 2541:, 2538:x 2532:) 2529:y 2526:, 2523:x 2517:) 2514:3 2511:, 2508:2 2505:, 2499:( 2490:) 2484:, 2478:, 2469:= 2450:y 2444:x 2441:( 2438:c 2432:y 2426:x 2420:c 2414:y 2408:y 2402:x 2396:x 2390:y 2384:x 2378:) 2375:3 2369:2 2360:( 2333:= 2311:r 2308:l 2305:c 2290:y 2278:x 2266:) 2263:3 2260:2 2251:( 2184:} 2175:( 2169:. 2163:{ 2157:} 2148:( 2142:. 2136:{ 2133:) 2130:3 2127:/ 2124:2 2118:x 2115:( 2106:} 2097:( 2091:. 2085:{ 2082:) 2079:3 2076:/ 2073:1 2067:x 2064:( 2052:. 2046:= 2043:x 2014:} 2005:( 1999:. 1993:{ 1987:} 1978:( 1972:. 1966:{ 1963:) 1948:. 1942:( 1928:C 1904:= 1809:) 1806:0 1803:. 1797:. 1794:e 1791:( 1779:) 1776:0 1773:. 1767:. 1764:e 1761:( 1749:) 1746:0 1743:. 1737:. 1734:e 1731:( 1721:e 1703:, 1697:, 1691:) 1688:e 1685:( 1668:e 1662:e 1656:e 1651:e 1619:i 1613:i 1572:} 1563:( 1557:{ 1548:x 1536:1 1533:{ 1524:x 1518:= 1503:2 1500:{ 1494:} 1491:1 1488:{ 1479:x 1473:= 1361:} 1352:{ 1349:} 1337:{ 1270:) 1264:( 1258:. 1249:) 1243:( 1237:. 1228:) 1219:x 1216:( 1204:. 1198:= 1195:x 1177:; 1171:= 1162:; 1156:= 1150:) 1141:x 1138:( 1111:; 1105:: 1099:? 1090:x 1087:= 1067:( 1061:C 1050:y 1047:= 1044:y 1041:_ 1032:x 1029:= 1026:_ 1023:x 1014:a 1008:a 1002:a 928:4 925:2 922:) 916:x 910:( 904:( 895:( 886:x 877:( 861:2 858:1 855:) 849:x 843:( 837:( 828:( 691:C 452:( 427:( 338:C 129:. 20:)

Index

If statement


computer science
programming language
Boolean
dynamic dispatch
runtime
statements
expressions
functional programming
side-effects
If Then Else
pseudocode
interpreter
Boolean
block
control
BASIC
home computers
GOTO
branch
spaghetti programming
structured programming
ALGOL
Pascal
Modula-2
C
Java
JavaScript

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑