August 30, 20187 yr I know scripts will need to use lots of if statements. However, if I use too many will that be a bad thing in terms of script performance or won't it matter much for the script at all? And if it does matter, are there alternatives to using if statements which I could implement instead?
August 30, 20187 yr I think too many if statements does not really affect performance if they get executed. Alternative would be switch-case.
August 30, 20187 yr 1 minute ago, Charlotte said: I think too many if statements does not really affect performance if they get executed. Alternative would be switch-case. yeah as charlotte said, use switch statements which will ahve cases - if ur switch matches the case it will then return xy or whatever ur case was.
August 30, 20187 yr Use as many if statements as you need. But if you find yourself with a series of 10+ if/else statements, then it could probably have been implemented in a better way.
August 30, 20187 yr Don't worry it won't affect the performance. Short answer; yes. If you are creating a more complex script you can make us of polymorphism, referenced assignments and branches.
Create an account or sign in to comment