Erik Cervin Edin
Erik Cervin Edin
[this works](https://play.minizinc.dev/#project=%7B%22files%22%3A%5B%7B%22name%22%3A%22Playground.mzn%22%2C%22contents%22%3A%22enum%20E%20%3D%20%7BA%2CB%7D%3B%5Cnarray%5B1..2%5D%20of%20var%20E%3A%20X%3B%5Cnconstraint%20X%20%3D%3D%20%5B%5Cn%20%20if%20i%20%3D%3D%201%20then%20B%20else%20_%20endif%5Cn%20%20%7C%20i%20in%201..2%5Cn%5D%3B%22%7D%5D%2C%22tab%22%3A0%2C%22solverId%22%3A%22org.minizinc.gecode_presolver%22%2C%22solverConfig%22%3A%7B%22enableTimeLimit%22%3Afalse%2C%22timeLimit%22%3A1%2C%22allSolutions%22%3Afalse%2C%22verboseCompilation%22%3Afalse%2C%22verboseSolving%22%3Afalse%2C%22compilerStatistics%22%3Afalse%2C%22solvingStatistics%22%3Afalse%2C%22outputTime%22%3Afalse%2C%22freeSearch%22%3Afalse%7D%2C%22minizincVersion%22%3A%22edge%22%7D) ``` enum E = {A,B}; array[1..2] of var E: X; constraint X == [ if i == 1 then B else _ endif | i in 1..2 ];...
Very nice. Also looks like it [works for `array2d`](https://play.minizinc.dev/#project=%7B%22files%22%3A%5B%7B%22name%22%3A%22Playground.mzn%22%2C%22contents%22%3A%22enum%20E%20%3D%20%7BA%2CB%7D%3B%5Cnarray%5B1..2%2C%201..2%5D%20of%20var%20E%3A%20X%20%3D%20array2d(1..2%2C%201..2%2C%20%5B%5Cn%20%20if%20i%20%3D%3D%201%20then%20B%20else%20_%20endif%5Cn%20%20%7C%20_%20in%201..2%2C%20i%20in%201..2%5Cn%5D)%3B%5Cn%5Cnoutput%20show2d(X)%3B%22%7D%5D%2C%22tab%22%3A0%2C%22solverId%22%3A%22org.minizinc.gecode_presolver%22%2C%22solverConfig%22%3A%7B%22enableTimeLimit%22%3Afalse%2C%22timeLimit%22%3A1%2C%22allSolutions%22%3Afalse%2C%22verboseCompilation%22%3Afalse%2C%22verboseSolving%22%3Afalse%2C%22compilerStatistics%22%3Afalse%2C%22solvingStatistics%22%3Afalse%2C%22outputTime%22%3Afalse%2C%22freeSearch%22%3Afalse%7D%2C%22minizincVersion%22%3A%22edge%22%7D) and I'm guessing the other multi-dimensional array creating functions ♥
> This is due to a quirk in the way integer literals and the `-` operator are parsed. Like in other languages, `-9223372036854775808` is parsed as the negation operator `-`...