learn-gdscript icon indicating copy to clipboard operation
learn-gdscript copied to clipboard

Error in code example logic in first lesson (1. What code is Like)

Open nocturnalmc opened this issue 1 year ago • 0 comments

Issue description: A clear and concise description of what the issue is.

  • In the section to try to spot similarities & differences in different languages there are error in the code logic
function take_damage(amout) {
    health -= amount
    if (health < 0) {
        die()
    }
}
  • Where as if health is exactly === 0 the function die() will not be called. Which mean the character still alive when health is exactly === 0
  • I think the correct comparison operator here is <=

nocturnalmc avatar Apr 24 '24 12:04 nocturnalmc