exercism / gdscript

Exercism exercises in GDScript.
https://exercism.org/tracks/gdscript
MIT License
6 stars 7 forks source link

Add space-age exercise #34

Closed BNAndras closed 11 months ago

BNAndras commented 11 months ago

@pfertyk, all eight implemented tests are picked up. There was a ninth test testing error handling, but I marked that as not included in the test suite. It's not that terribly interesting of a test so we won't miss it.

pfertyk commented 11 months ago

We can do it like that, or we can return a null (or 0) in case of an error. For this exercise, I think it would be a rather clean workaround for the fact that Godot doesn't support error handling :)

Which option do you think is better?

BNAndras commented 11 months ago

For this particular one, it doesn’t matter so I’d just not include it. The instructions don’t even suggest the possibility of using a star so the test comes out of nowhere. As a general rule, Exercism tries to not pass bad input unless error-handling is in some way important to the problem.

In general, returning a null is probably fine though since it represents an absence of data. 0 might be a valid value in some contexts so I’d avoid that.