Byacca Apr 21 @ 7:22am
How do i make two globals change their places?
Hello, Everyone!
Here's the thing. I want my two global variations to take each other places.
Let's say it is "global.first = 2 and global.second = 4". I want them to became: "global.first = 4 and global.second = 2" and vise versa by pressing a button.
If anybody knows how to do this, please tell me
Showing 1-3 of 3 comments
< >
Keys Apr 21 @ 9:44am 
The way I do this is to just create a temporary variable before switching them like this:
remember = global.first;
global.first = global.second;
global.second = remember;

There might be a better method but this one works.
Zaron X Apr 21 @ 9:59am 
The var keyword is a good concept to look into, on that. It creates a variable that basically only exists until the present block of code finishes running, and it's surprisingly handy.
Byacca Apr 21 @ 10:40am 
Thank you, guys! You are realy saving me
Showing 1-3 of 3 comments
< >
Per page: 15 30 50
Date Posted: Apr 21 @ 7:22am
Posts: 3