[bug]parser does not recognize :-> in function declaration as error

function _getUUID():->uuid:string should throw an error. (notice the colon before the return parameter)
instead, it does not recognize uuid when it is assigned, later in the function (value remains undefined)

Hey Mikey,

you shouldn’t use :-> in function declaration
you have two options :

  • you can use your code will be like this:
function _getUUID()->uuid:string
  • or you can use
function _getUUID():string

and then you should use return with it.

for more details you can check this section Function

1 Like

Hello Mikey,

You should refer to the documentation in the link below:
Parameters | Qodly Developer Center (docqodly.github.io)

As you see in the return value, it doesn’t exist the colon before the arrow (->).
There are two ways of returning value in a function:

  • adding an arrow (->) and the parameter definition after the input parameter(s) list
  • or adding the colon ( : ) and then the type of the returning value.

Best regards.

the bug is that the parser does not identify the error.
i understand what i’m supposed to do. i am not new to this syntax. that is how i recognized the error, and the fact that there is a bug in the editor/parser not identifying it.
as for how one produces this error, it’s pretty simple: i switched from an unnamed return value to a named one, and while i was doing that, failed to remove the colon.

1 Like