# Make a number positive

For questions about using Classic.

### » Sat Oct 01, 2011 6:09 am

Is there an easy simple way to make a number positive in an expression? For instance, the value I'm using could range from -200 to 200, but if its -200 I want it to be 200.

I know you can do *-1, while its good for making negative numbers positive it will make the positive numbers negative. But I only want positive.

At the moment I'm doing an X>0?A:B thing, but I'm just interested to know if there is a different method I could use in an expression.

alspal2011-10-01 06:09:53
B
135
S
65
G
17
Posts: 1,766
Reputation: 19,727

### » Sat Oct 01, 2011 6:25 am

The easiest would be to use the Absolute Value expression or "abs()".

ex:
abs(-2)=2
abs(2) =2

Edit:
Barely beat tulimide.R0J0hound2011-10-01 06:27:18
B
82
S
26
G
63
Posts: 4,840
Reputation: 45,720

### » Sat Oct 01, 2011 6:25 am

there's the absolute expression: abs()
it returns a value without sign (that is: the positive representation)

abs(-200) = 200
abs(200) = 200

ROJO was quicker^^tulamide2011-10-01 06:26:04
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

### » Sat Oct 01, 2011 6:44 am

thanks so much guys! thought it would be something simple :)
B
135
S
65
G
17
Posts: 1,766
Reputation: 19,727

### » Sat Oct 01, 2011 10:00 am

R0J0hound - Posted: Today at 6:25am
Edited by R0J0hound - Today at 6:27am

tulamide - Posted: Today at 6:25am
Edited by tulamide - Today at 6:26am

Fastest guns in the west. It is even more amusing as your formatting for both the posts and edits is so similar. Good work chaps.

B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Return to Help & Support using Construct Classic

### Who is online

Users browsing this forum: No registered users and 3 guests