# Noob question: Value from class

**URL:** <https://forum.kirupa.com/t/noob-question-value-from-class/244997>\
**Category:** flash\
**Created:** [November 24, 2007, 10:57pm UTC](https://forum.kirupa.com/t/noob-question-value-from-class/244997 "2007-11-24T22:57:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpann](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tpann](https://forum.kirupa.com/u/tpann)\
**Post date:** [November 24, 2007, 10:57pm UTC](https://forum.kirupa.com/t/noob-question-value-from-class/244997/1 "2007-11-24T22:57:46Z")

</div>

I want to do create a class that rounds off a decimal. I’m running into problems and I assume the solution is pretty simple but I’m not finding an answer in the books I have nor in searches.

Here’s what I have:

```auto
package {
 
 public class Round {
  private var _num:Number;
  private var _int:int;
  private var _decimal:Number;
 
  public function Round(num:Number):Number {
   _num = num;
   _int = int(_num);
   _decimal = _num - _int;
   if (_decimal >= 0.5) {
    return _int + 1;
   } else {
    return _int;
   }
  }
 }
}

```

First of all, I know that you can’t have a constructor return a value, but I have tried to simply reassign the code to a non-constructor function and still cannot make this work.

Again, I’m sure it’s simple but I’m just not well-versed enough in AS3. How do I make my class return a simple value, so that I can call, for example, Round(2.355) and get 2?

Thanks!
