1

How do you create an array in vyper?

I want to create the array below but vyper is confusion.

Outcomes = [5, 500, 5000, 50000, 500000000, -1, -100, -1000, -10000, -100000, -500, -5000, -50000, -500000, -10000000, -50000000]

1 Answer 1

3

Vyper is a statically typed language, which means that the type of each variable must be specified when it is declared.

An array is cast by applying a subscript ([]) to a base type. In your example, because some values are less than zero, the base type is int128. There are 16 values, so the final type is int128[16].

Outcomes: int128[16] = [5, 500, 5000, 50000, 500000000, -1, -100, -1000, -10000, -100000, -500, -5000, -50000, -500000, -10000000, -50000000]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.