# NaN function in a math game

**URL:** <https://forum.kirupa.com/t/nan-function-in-a-math-game/192055>\
**Category:** programming\
**Created:** [June 25, 2006, 5:24pm UTC](https://forum.kirupa.com/t/nan-function-in-a-math-game/192055 "2006-06-25T17:24:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greenthree](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@greenthree](https://forum.kirupa.com/u/greenthree)\
**Post date:** [June 25, 2006, 5:24pm UTC](https://forum.kirupa.com/t/nan-function-in-a-math-game/192055/1 "2006-06-25T17:24:53Z")

</div>

I am following a tutorial in a book I purchased for a math game, and even though my code is exactly the way it is on the page, I keep getting an error.

First of all, here is the AS:

if (guess == correct) {  
result = “Great Job!”;  
numRight++;  
} else {  
result = X+"+"+Y+"="+correct;  
}

numTries++;  
percRight = numRight/numTries\*100;  
\_back.onRelease = function() {  
if (numTries\<5) {  
\_root.gotoAndStop(“solve”);  
guess = “”  
} else {  
numRight = 0;  
numTries = 0;  
guess = “”;  
\_root.gotoAndStop(“choose”);  
}  
}

When it tries to calculate the percentage (percRight = numRight/numTries\*100; ) i get “NaN” (Not a number) in the dynamic text box. Any thoughts?
