# Beginner needs help

**URL:** <https://forum.kirupa.com/t/beginner-needs-help/289075>\
**Category:** Uncategorized\
**Created:** [May 26, 2009, 4:26am UTC](https://forum.kirupa.com/t/beginner-needs-help/289075 "2009-05-26T04:26:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidtidwell86](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@davidtidwell86](https://forum.kirupa.com/u/davidtidwell86)\
**Post date:** [May 26, 2009, 4:26am UTC](https://forum.kirupa.com/t/beginner-needs-help/289075/1 "2009-05-26T04:26:10Z")

</div>

Hello, I have the following statement in my code:

```auto

if( spriteSpeed > 0 ) {
                    if( spriteSpeed > spriteMaxSpeed )
                    {
                        spriteSpeed = spriteMaxSpeed;
                    }
                } else if ( spriteSpeed < 0 ) {
                    if( spriteSpeed < -( spriteMaxSpeed ))
                    {
                        spriteSpeed = -( spriteMaxSpeed );
                    }
                }

```

It works fine, but my question is whether or not there’s a more ‘professional’ way to rewrite this. It seems inefficient to treat the positive and negative signage separately. Thanks so much for your help!
