ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:swap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
functions:swap [2019/09/05 23:41]
korshun removed
— (current)
Line 1: Line 1:
-====== swap ====== 
-{{tag>math acs_enhancements}} 
-''any, any swap(any a, any b)'' 
  
-[[:types|any - any type (int, fixed or str)]] 
- 
-[[:Multiple_return_values|This function returns multiple values.]] 
- 
-===== Description ===== 
-Returns two variables in a swapped order. This function exists to improve readability. 
- 
-===== Examples ===== 
-Without swap(): 
-<code> 
-int tmp = x; 
-x = y; 
-y = tmp; 
-</code> 
- 
-With swap(): 
-<code> 
-swap(x, y); 
-x = r1; 
-y = r2; 
-</code>