E07560: must be an Integer with a value greater than zero

Category: E07xxx Full resolution · Reported in phase: FULL_RESOLUTION · Classification: MUST_BE_INTEGER_GREATER_THAN_ZERO · All error codes

What went wrong

An Integer value is required to be greater than zero (positive) in this context.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 125 (How do I use head, tail, and skip to limit streams in EK9?)

How to fix it

  1. Use positive Integer value (> 0)

Common causes

  • Zero value where positive required
  • Negative value where positive required
  • Array size, count, or repetition count

See also

  • E07560: positive Integer required (this error)
  • E07550: Integer return type required

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E07560: must be an Integer with a value greater than zero

#!ek9
defines module error.e07560.bad

  defines function

    firstOnes()
      <- rtn as List of String: List()

      //head of nothing makes no sense
      cat ["last", "first"] | head 0 > rtn

Fixed: Use a count of one or more

#!ek9
defines module error.e07560.good

  defines function

    firstOnes()
      <- rtn as List of String: List()
      cat ["last", "first"] | head 1 > rtn

Questions and answers

These Q&A entries show E07560 and its fix: