Welcome to the Creatures Wiki! Log in and join the community.

# ABSV

Jump to navigation
Jump to search

ABSV | ||
---|---|---|

This article is about a CAOS command or function. | ||

Category |
Variables | |

Version |
CV/C3/DS | |

Command | ||

Parameters |
number (variable) | |

Function | ||

Parameters |
||

Return type |
[[CAOS types|]] | |

Related | ||

CAOS |
NEGV | |

Concepts |

**ABSV** makes the numeric value of a variable positive.

## Command

Syntax: *ABSV X(variable)*

This makes the numeric value contained in *X* positive, i.e. gives it its absolute value. To be precise, if *X* is less than 0, *X* is set to the negative of *X* (e.g. -5 is changed to 5), otherwise, it is left unchanged.

Mathematically, this is normally written as |x|. It's equivalent to the 'abs' function in various other languages.

## Example

This code sets va00 to -4, and then uses **ABSV** on it, changing it to 4.

SETV VA00 -4 ABSV VA00