Jump to content

4d4a5852

Member
  • Content Count

    1
  • Joined

  • Last visited

  • Medals

Community Reputation

2 Neutral

About 4d4a5852

  • Rank
    Newbie

Recent Profile Visitors

334 profile views
  1. switch works by comparing the condition to the different cases. So doing something like switch (true) do { case (a > 5): {...}; case (a == 2): {...}; default {}; }; is fine - see Example 3 But when only comparing a variable to strings there's no reason to abuse switch in such a way - i.e. just use its standard syntax. Additionally switch (_projectile != "") do { will resolve to false when _projectile is an empty string and therefore the first case which also resolves to false will be executed - i.e. move the check into a separate if-block. But the reason for the code not working is that _finalDamage isn't declared in the main scope before the switch, i.e. the value assigned to it within the switch-cases will be lost afterwards e.g. define/declare it at the beginning of the script.
×