Hi Sergei
Sergei Gavrikov wrote:
> What I try to do using CDL expressions
>
> if {board == A} {
> default_value A
> legal_values {A B C}
> } else if {board == B} {
> default_value X
> legal_values {X Y Z}
> }
>
> and using in two-lines coding I could get only, for example,
>
> default_value B
> legal_values {A B C X Y Z}
>
> Thanks for any comments on it.
The following should work, but there may be a more elegant approach:
default_value { (board == "A") ? "A" : "X" }
legal_values {
((board == "A") ? "A" : "")
((board == "A") ? "B" : "")
((board == "A") ? "C" : "")
((board == "B") ? "X" : "")
((board == "B") ? "Y" : "")
((board == "B") ? "Z" : "")
}
John Dallaway
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss