PureBytes Links
Trading Reference Links
|
neo,
If A > B then
C = 10
Endif
is logically equivalent to :
If A > B then
C = 10
( Implied Else )
( C is not modified )
Endif
It doesn't tell you anything about was C is supposed to be when A <= B
If you are expecting Metastock to not plot anything when A<=B, then you are
expecting C should undefined when the "IF" statement is FALSE, which is not
the same as "C is not modified"... Your implied logic is therefore :
C = Undefined
If A > B then
C = 10
Endif
or
If A > B then
C = 10
Else
C = Undefined
Endif
----- Original Message -----
From: "neo" <neo1@xxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Thursday, December 28, 2000 3:05 PM
Subject: RE: If Then function
> Tom
>
> I think it is too picky. Although I hate to drag this out and I am not a
> computer language expert, the early computer languages did not include an
If
> Then Else function. The only way this could be programmed was with 2 If
Then
> statements. If you want to say that an If Then function has an implied
Else
> of dropping to the next line of code then every statement (other than a
> direction out of the normal code path) has an implied Else function. The
> statement A=B implies that one drops to the next line of code.
>
> neo
>
> -----Original Message-----
> From: owner-metastock@xxxxxxxxxxxxx
> [mailto:owner-metastock@xxxxxxxxxxxxx]On Behalf Of Tom Sprunger
> Sent: Wednesday, December 27, 2000 5:41 PM
> To: metastock@xxxxxxxxxxxxx
> Subject: Re: If Then function
>
>
> Computer languages have two possible results when you use an IF statement.
> When the IF is evaluated as True, the instructions associated with the IF
> are executed (the Then). When the IF is false, the next line of code is
> executed. The program completes the logical IF, Then, Else test by going
to
> a predefined Else action.
>
> The Else statement (in computer language) allows a conditional branch to
> some action other than the predefined next line of code. Else tells the
> computer what to do in the case that the IF evaluation is false and you
> don't want to go to the next line of code (predefined Else action).
>
> So in the statement with no Else, the "Else" action is assumed. Its still
> there logically, its just not required for the programmer to input it.
>
> So, no, computer languages do not explicitly require an Else statement.
> But, every computer language has a implicit Else statement built in that
the
> program uses to decide what the action will be for a false evaluation of
the
> IF statement if the programmer does not explicitly define it with the use
of
> an Else. From a logical standpoint you must have an action for a false
> evaluation, even if it is "continue what you were doing before the IF was
> evaluated".
>
> Same is true for humans. You must have a predetermined action for a False
> evaluation of IF. Example. You are driving down the street. You come to
a
> stoplight. IF the light is red, Then you stop. What do you do if it isn't
> red? You keep going. That is because you have predefined that the action
> for a false IF evaluation is to continue what you were doing before the
> light turned red. However, you could just as easily have predetermined
that
> you turn right If the evaluation of the stoplight color is not red.
>
> The point is that logically any time you have a test you have a decision
> which by definition has at two possible outcomes (boolean logic). That is
> the point I was making. You have to define both outcomes either implictly
or
> explicitly.
>
> Too picky?
>
> Tom
>
>
> ----- Original Message -----
> From: "Mike Campbell" <ug@xxxxxxxxxxxx>
> To: <metastock@xxxxxxxxxxxxx>
> Sent: Wednesday, December 27, 2000 3:15 PM
> Subject: Re: If Then function
>
>
> >
> > >> An IF function must have an Else as well as a Then to be logically
> > >> correct. It is impossible to have no Else without violating the
> > >> rules of logic. It would make no sense to either a computer or a
> > >> human.
> >
> > Can you name me a computer language that requires an else statement?
> >
> > Neither computers nor humans *require* an else.
>
>
>
|