Incomplete: premature end of input(about function)

hi guys, i am recently introduced to Julia. I have a problem with " function", I don’t know how to debug this problem. can you help me? Thank you very much!

I see no problem with your code, are you sure you did not insert a special character in the code?

Is it at all possible that you highlighted line 1 and 2 and then clicked Ctrl + Enter? I would expect that error if you accidentally executed just the first two lines.

Yes, this is the code from GPT. Is there something wrong with installation or package by any chance?
Do you know how i can check that?

Thank you so much!!The reason is what you said!Thank you :blush:

Thank you! :grinning:

Since nobody else brought it up, it is probably not a good idea to use a variable named sum because that conflicts with the function called sum.