Difference between 2 numbers

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Difference between 2 numbers

Post by Nakia » Thu Jan 24, 2013 7:44 am

Hi,

What is the operator to calculate the difference between 2 numbers?

For example

Value 1 = -250
Value 2 = 250

Difference in numbers equals 500 etc..

Sorry if this is a dumb question but I have not had to do it before !

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10058
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Difference between 2 numbers

Post by FourthWorld » Thu Jan 24, 2013 8:17 am

The key may be the abs (absolute) function:

put abs( tVal1 - tVal2)


[We have a momentary limit on the server in which it requires a minimum of 100 chars, so this sentence is just filler; please ignore]
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply