Why do some func definitions have a trailing const?

Some of the methods (e.g. String.bool) have signatures which are suffixed with “const”. Some don’t (such as Node2d.apply_scale).

Why is that? I’m not finding it explained in the documentation. I can’t seem to use it for my own functions so I am thinking that these are defined in C++ but if that is the case I wonder why they are marked as such in the documentation.

Even the non-const methods cannot be overridden, so it is puzzling to me as to how to use this information.

From the link posted by Wyattbiker:

const actually means that the function has no side-effect, i.e. it won’t change any property of the object when called.

1 Like
1 Like

So a const suffix means the same as in C++. I wonder why we can’t do the same for our own functions but at least this answers my question. Thank you!

1 Like