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 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#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 #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
How to get front page or home page ID in WordPress?WordPressSome EASY-to-Understand CSS media query examplesCSSVariables and Distance Functions in SCSS (Sass)SCSSSQL Right JoinSQL/MySQLHow to include CSS and JavaScript files in your WordPress plugin?WordPressArray destructuring and Object destructuring in JavaScriptJavaScript