# Interesting way of defining drawRect:

**URL:** <https://forum.kirupa.com/t/interesting-way-of-defining-drawrect/296188>\
**Category:** flash\
**Created:** [September 10, 2009, 3:41pm UTC](https://forum.kirupa.com/t/interesting-way-of-defining-drawrect/296188 "2009-09-10T15:41:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![monotypic](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@monotypic](https://forum.kirupa.com/u/monotypic)\
**Post date:** [September 10, 2009, 3:41pm UTC](https://forum.kirupa.com/t/interesting-way-of-defining-drawrect/296188/1 "2009-09-10T15:41:31Z")

</div>

Hey guys,  
I’m currently working my way through Joey Lott and Danny Patterson’s Actionscript 3 with Design Patterns book and ran into this code:

```auto

// var center is a boolean:
// var shapeWidth and shapeHeight are just Numbers that get passed in from a function.

var shape:Sprite = new Sprite();
addChild(shape);
			
shape.graphics.lineStyle(0,0,0);
shape.graphics.beginFill(0xFFFFFF);
shape.graphics.drawRect(center ? -shapeWidth / 2 : 0, center ? -shapeHeight / 2 : 0, shapeWidth, shapeHeight);
shape.graphics.endFill();

```

I’m confused by the “?” and the " : 0 ".

Could someone please explain how the drawRect is working in plain english? It looks totally awesome but I’ve never come across something like that.

Thanks for your time!
