❔ Permut array's values
Hello, is there a convenient way to swap array values in their array, for example transforming a {1,2,3,4} into a {1,4,2,3} I dunno. Because when I think of this I believe that a need to create a copy of the first array as a reference before swapping the values, but maybe there is a better way.
5 Replies
You can save the first value in a temp variable, then assign the second value in the first value place, then assign the second location the value in temp.
thinker227#0000
REPL Result: Success
Result: int[]
Compile: 427.710ms | Execution: 58.419ms | React with ❌ to remove this embed.
Tuple swap FTW
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.