Monday 15 April 2013

Javascript while loop not looping -


It mostly works, but when it hits, it is not a loop. What have I done with the loop?

  var slaying = true; Var youHit = Math.floor (Math.rendum) * 2); Var Damageound = Monastic Floor (Math.Random) * 5 + 1); Var totalDamage = 0; While (murder) (ifHit) {console.log ("You hit python."); Total loss + = damage; if (total damages> = 4) {console.log ("You killed the dragon Kill; false;} and {youHit = Math.floor (Math.rendum) * 2);}} Else {console.log ("The Dragon defeats you.");} Murder = false; } << code>   

Variable slaying is always set to < False is at the end of the loop, so it is never sent more than once.

No comments:

Post a Comment