Search code examples
arraysinitializationeiffel

How to initialize an array in Eiffel


How to initialize an array with a list of numbers in Eiffel?

In C it would be like this:

int foo[] = {2, 3, 5, 7, 10, 87, 72, 67, 1, 0};


Solution

  • Like This:

    make
        local
            foo: ARRAY [INTEGER]
        do
            foo := << 2, 3, 5, 7, 10, 87, 72, 67, 1, 0 >>
        end