Main Page

Monday, January 7, 2019

What is the difference between .@i++ and ++.@i ?

Just now when I wrote a script over discord, part of that script has shuffle algorithm
he asked, can I just change the [--.@range] into [.@range--] ?

Of course the answer is NO !

The reason is because .@i++ and ++.@i has a slight difference

Short answer is:
++.@i adds the value directly
.@i++ will add the value AFTER the command execute

Long answer is:




Note: when the .@i++; or ++.@i; on its own, its the same, notice the semi-colon
it only difference when put into a command, or array for example



By the way, most of my script uses ++.@i in the for-loop, because Haru said so

No comments:

Post a Comment