Skip to content

Lessons and practices about loops: Consider explicitly call functions when possible over looping implicitly #1377

Description

@NathanLovato

GDScript has some syntax sugar to automatically loop over collections implicitly, like when you loop over a dictionary, it calls the keys() method to get a list of all the keys in the dictionary.

In L25, when looping over dictionaries, we end up using this in examples at the time because it's become idiomatic in GDScript. A learner suggested using explicit method calls and it's something to at least review and consider in the lessons. Just like how in Learn 2D Gamedev From Zero we ended up using get_node() a lot over syntax sugar to help learners wrap their head around the fact that you're just calling functions that follow a series of steps to return the result, that it's not magic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentIssues with the lessons, practices, including their code examples

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions