Consultor Eletrônico



Kbase 15979: ASSIGN x = IF <condition> ... requires default ELSE clause
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
ASSIGN x = IF <condition> ... requires default ELSE clause

The following is valid 4GL syntax:

DEFINE VARIABLE x AS CHAR.
DEFINE VARIABLE y AS CHAR INIT "abc".
ASSIGN x = IF y = "abc" THEN "it's abc"
ELSE "not abc".
DISPLAY x.

In this example, x will be assigned the value "it's abc".

When using the ASSIGN...IF syntax, you must include an ELSE clause
to prevent the conditional tests from falling through without having
ASSIGN'd a value. For instance, the following syntax is not allowed:

ASSIGN x = IF y = "abc" THEN "it's abc".

This statement results in error 247 "Unable to understand after --
ASSIGN x" because there is no ELSE clause to trap the failed condition
test. Similarly, the next statement is also invalid:

ASSIGN x = IF y = "abc" THEN "it's abc" ELSE
IF y = "xyz" THEN "it's xyz".

Again, the possibility exists that the ASSIGN statement will not have
a valid value once the conditional expression is evaluated so this
is not permitted.

Progress Software Technical Support Note # 15979