[go: up one dir, main page]

kex oops docs ↗ kex.run ↗

All codes › Parse

KEXEP-0001

error ReservedWordAsFunctionName

[KEXEP-0001]: Error, `keyword` is a reserved keyword in Kex, so it cannot name a function. Rename it

break is a keyword, so a function cannot be called that. The same goes for return, then, while, when, if, do and end, among others.

let break(text: String) -> [String] = text.split(" ")
example.kex:1:5: [KEXEP-0001]: Error, `break` is a reserved keyword in Kex, so it cannot name a function. Rename it
  |
1 | let break(text: String) -> [String] = text.split(" ")
  |     ^^^^^

A keyword used as a variable name is KEXEP-0124.

Fixing it

Pick another name:

let words(text: String) -> [String] = text.split(" ")

main do
  IO.printLine(words("a few words"))
end

Edit this explanation

Is this diagnostic reported where it should not be, missing where it should be, or saying the wrong thing? Report it on the compiler's issue tracker.