All Questions

Community

Luca Leonardi(LuxeL)

Difference between return and pass in an empty function

Hi,

I see you use the keyword return while setting up the functions is the abstract State class. I was used to the "Godot way", pass. What's the difference? Is there any difference at all?

It's marginal but I'm curious... Maybe return actually returns a value that it's "null" or something, while pass completely skips the function? Does this impact the performance?


Ps: I take this opportuniy to ask a question not related to this course: is there a keyboard shortcut for changing video playback speed? I'm used to Youtube where you can "Shift + >" your way through the video, is there an equivalent here?

  • GDQuestions replied

    There's no significant difference between pass or return in an empty function: it will execute in both ways and implicitly return null.

    Also no, I don't think we have a video speed shortcut.