Город МОСКОВСКИЙ
00:05:16

Enable GDScript Type Hints for Better Code | Godot 4 Quick Tip

Аватар
TypeScript Рефакторинг
Просмотры:
31
Дата загрузки:
30.11.2023 00:45
Длительность:
00:05:16
Категория:
Видеоигры

Описание

Out of the box, Godot doesn't enable type hints for GDScript even though the language can be both dynamically or statically typed. After a decade of writing code in both dynamically typed and statically typed languages, I've found static typing to be immensely helpful. Static typing helps set expectations for that parameter types to pass along as well as what's returned. I've found that it helps catch bugs and coding errors sooner.

In Godot 4, all you need to do is enable Editor Settings ➡ Text Edtior ➡ Completion ➡ Add Type Hints.

Static typing does become a personal preference at a certain point, so do what works for you! Something neat with GDScript is that you can mix and match as you want to.

Godot version used: 4.0

Check out my games: https://brettchalupa.itch.io/
Subscribe to my newsletter: https://www.brettchalupa.com/newsletter
Donate as a way to say thank you: https://www.buymeacoffee.com/brettchalupa

Рекомендуемые видео