-3

For example: What does a: x = 5 mean? Does the variable get a copy assigned to it? What's the purpose of this?

Tomerikoo
  • 15,737
  • 15
  • 35
  • 52
  • 1
    Could you provide a bigger example maybe? Snippet provided causes Name Error. Don't you mean something like `a: int = 5`, which is using *type annotations*? – matszwecja May 31 '22 at 08:59
  • Does this answer your question?: https://stackoverflow.com/questions/51639332/use-of-colon-in-variable-declaration – Lecdi May 31 '22 at 09:00
  • 1
    @matszwecja Well, it's technically a NameError, not a SyntaxError, but either way I think it's clear that they're asking about type annotations – Lecdi May 31 '22 at 09:01
  • Did you mean like in `if 1+1==2: x = 5` ? – cfgn May 31 '22 at 09:07
  • @Lecdi that helped, yes! I was having difficulties trying to find the question here – Pedro Magno Müller May 31 '22 at 14:56

0 Answers0