# 論理式と比較式 Decodal は具体的な `Bool` に対する論理演算と、具体的な scalar value に対する比較をサポートする。 ```dcdl { is_prod = env == "prod"; high_port = port > 9000; enabled = is_prod && high_port; disabled = !enabled; } ``` ## 論理演算子 - `!expr` は具体的な `Bool` を反転する。 - `lhs && rhs` は論理積を返す。 - `lhs || rhs` は論理和を返す。 `&&` と `||` は短絡評価され、右辺は必要な場合にだけ評価される。 論理演算の operand は具体的な `Bool` へ評価される必要がある。 ## 比較演算子 - `==` - `!=` - `<` - `<=` - `>` - `>=` `==` と `!=` は、`String`、`Bool`、`Int`、`Float` の具体的な scalar value を比較する。 `Int` と `Float` は数値として相互に比較できる。 順序比較演算子 `<`、`<=`、`>`、`>=` は、具体的な数値だけを比較する。 これらは `> 443` のような prefix comparison constraint とは別のものである。 ```dcdl port = Int & > 443 default 9443; is_high = port > 9000; ```