Yogesh Chauhan's Blog

ABS and NEG functions in Envision Basic

in Envision Basic on December 25, 2021

In Envision basic, there are many useful functions that comes handy. Especially when performing some quick mathematical operations, it saves us a few lines of code.

ABS and NEG are a couple of those kinds of functions that comes handy for math operations.

These functions are really easy to use and mostly don’t require any complex logic to use them.

ABS Function

The ABS function is nothing but an absolute value function. It returns the positive numeric value of the
argument.

Syntax


ABS(expr)

Example

This will change X.NUMBER variable’s value to a positive 1 from a negative 1.


X.NUMBER = -1
X.NUMBER = ABS(X.NUMBER)

NEG Function

The NEG function changes the value of the passes numeric value to the opposite sign value.

So, if the passes expression is of a positive value, it’ll change it to a negative value and return it.

If the passes expression is of a negative value, it’ll change it to a positive value and return it.

Syntax


NEG(expr)

Example

This will change X.NUMBER variable’s value to a positive 1 from a negative 1.


X.NUMBER = -1
X.NUMBER = NEG(X.NUMBER)

This will change X.NUMBER variable’s value to a negative 1 from a positive 1.


X.NUMBER = 1
X.NUMBER = NEG(X.NUMBER)


Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
How to create a placeholder loader (throbber) using CSS?CSSHow to change the Login Logo in WordPress?WordPressWhat is Hadoop and Hadoop Ecosystem?MiscellaneousLEFT JOIN in PostgresPostgresFor Each Loop in Swift for BeginnersSwiftExplanation of PostgreSQL PgAdmin interfacePostgres