Sublime Forum

Function works, variable does not

#1

I am very green but already stuck for a long time. My code works for the simple PRINT function. However as soon as I try to add a variable for it I get invalid syntax
My code:

{ message="text"
print (message)
}

Output:

SyntaxError: invalid syntax
[Finished in 0.1s with exit code 1]
[cmd: ['python3', '-u', '/Users/name/Desktop/mam.py']]
[dir: /Users/name/Desktop]
[path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin]

Thank you so much for your help :pray:

0 Likes

#2

If you’re trying to write python, {} does not denote a code block but instead a dictionary. Try without it.

2 Likes

#3

Thank you so much! It works perfectly now :smile:

0 Likes