# Imperative (not functional) languages are so boring. Long life to logical and declarative programming like Prolog

- 1 minutes read - 49 wordsBelow a simple example of using a a declarative language (Prolog) for finding all solutions for a trick game…

```
?- use_module(library(clpfd)).
?- X in 1..9, Y #= (X * 3 + 3) * 3, Z #= (Y rem 10) + (Y div 10), setof(Z, X^Y^label([X,Y,Z]), Sol).
Sol = [9],
```