If

 

(0)                    If

 

…is a frequently used suffix or prefix keyword modifier.

 

If[test, trueRes, falseRes]

If[test, trueRes, falseRes, otherRes]

 

If[PatternSet, doIfMatch]

…or…

PatternSet doIfMatch

…is a Rule.  It behaves like a PatternSet insofar as it expects a source to compare to the PatternSet.

A Rule defines the scope of a SubstitutionName. For example,

If[Type[subNam, PatternSet], doIfMatch , doIfNotMatch]

…or, equivalently…

subNam_PatternSet (doIfMatch | doIfNotMatch)

…is the fully general form for a Rule that substitutes subNam in “doIfMatch” if subNam matches  and substitutes  subNam in “doIfNotMatch” if subNam does not match.

 

 

See English definition for “if”.

 

 

(1)                    If[test, trueRes, falseRes]

 

…returns trueRes if test is True and falseRes if test is False.

 

 

 

(2)                    If[test, trueRes, falseRes, otherRes]

 

…returns trueRes if test is True and falseRes if test is False.

If test is neither True nor False then otherRes is returned.

 

 

 

Rule

 

The following ElicitationForm is called a Rule:

 

(3)                                If[PatternSet, doIfMatch]

            This is also written as…

(4)                                PatternSet doIfMatch

 

A Rule behaves like a PatternSet insofar as it expects a source to compare to the PatternSet, but it is unlike a PatternSet insofar as it does not generally return a Boolean result.  The PatternSet in (3) or (4) can be a Type[_, _], (a.k.a. SubstitutionName) scoped construct.

 

If patrnSet is a PatternSet, then the a handy and general Rule form is the following:

 

(5)                                If[Type[subNam, patrnSet], doIfMatch , doIfNotMatch]

 

If patrnSet matches, subNam is substituted throughout doIfMatch, and the evaluated result is returned.

If patrnSet does not match, subNam is substituted throughout doIfNotMatc, and the evaluated result is returned.

 

 

English Definition of “if

 

if conj.

1. In case that; granting, allowing, or supposing that;  --introducing a condition or supposition, or sometimes, as for rhetorical effect, a concession; as, if he should slip, death is certain. if they are rich, they are not snobbish.  Conditional clauses introduced by if may be a classified as expressing:

    (1) What the speaker assumes or admits as actual fact.  Here both condition and conclusion typically have the indicative; as, if he sees it, he will tell.

    (2) What the speaker regards as contingent, and withholds endorsement from as fact.  Here both condition and conclusion typically has the present subjunctive; the conclusion, the indicative; as, if he see it, he can tell

    (3) What the speaker regards as contrary to fact.  Here the condition typically has the pluperfect, or the preterit subjunctive; the conclusion, the "conditional" mood with should or would; as if he were to see it, he would tell us.  The verb after if is often omitted where the context readily suggests it; as, that is important, if trueIf is itself often omitted from a conditional clause, which then usually inverts the order of subject and verb; as, had he seen us, he would have come. A conditional clause with if sometimes stands alone as a rhetorical exclamation; as, if the rascal hasn't come again!

                                                            [From Websters1949Unabridged.]

 


Grok32`

© 2004 by John Van Wie Bergamini. All rights reserved.

Hosted by www.Geocities.ws

1