0

I'm writing the following nested function where dfsVisit uses the arrays "numCaminos" and "colores" declared in the outer function enter image description here

However the kotlin compiler is giving me a "variable expected" error on the assignments in lines 31 and 34 specifically, this error doesn't show up on any of the other Array assignments within the nested dfsVisit function. I tried de-nesting the functions and passing the arrays as arguments of dfsVisit but the problem persisted on those 2 assignments specifically. Why could this be happening?

I'm running the Kotlin compiler in Manjaro Linux through the repository package

Note: Sorry for using a picture instead of a code block, the post editor was giving me some formatting issues.

1
  • 1
    For reference, this answer explains some reasons why posting text is better than images; it also links to this question giving info on how to format code blocks. Commented Mar 24, 2022 at 10:30

1 Answer 1

1

Just remove !! from the left side of the assignment. It doesn't really make sense there.

Sign up to request clarification or add additional context in comments.

1 Comment

Well this was anti-climactic, thanks it worked

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.