Best of Support

Else and ElseIf logic in GhostFill

Issue

How do you handle Else and ElseIf conditions in GhostFill?

Solution:

I was trying to explain GhostFill to a client with respect to negative logic, and I reached an epiphany. I was trying to find an equivalent of ELSE coding which I use extensively. Here is what I found:

%[KeepBlockIf(Variable)]

 

%[EndBlock()]

%[DeleteBlockIf(Variable)] 

 

%[EndBlock()]

 

The block in RED functions like an ELSE. Now, if we need an ELSE IF, you would structure it this way:

%[KeepBlockIf(Variable1)]

 

%[EndBlock()]

%[DeleteBlockIf(Variable1)]

%[KeepBlockIf(Variable2)]

 

%[EndBlock()]

%[EndBlock()]

 

It is actually quite an elegant structure that makes clear what the actual conditions are on each block of text, whereas the ELSE command does not tell you "Else what?" 

 

Seth Rowland