What's := for?

I’ve read it somewhere but I read too many things lately about verse and can’t remember where it is.

It’s like C# “ref”?

1 Like

The := is used when you are both declaring a constant and setting its value at the same time, without specifying the type.

So normally you can declare a constant like this:
MaxHealth : int = 100

But if you are inside a function, you can leave out the type and let it be inferred by the value (when outside of a function, you have to declare the type).

MaxHealth := 100

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.