Never Mind about my last topic. Help, how do I loop?


#1

var clashRoyale  confirm("Welcome to the Arena, Challenger! To Enter the Full game, you must Beat me. The Creator.");
if (clashRoyale === true) {
    alert("Well then. Prepare for the Battle to start your Journy in the World of Clash Royale.");
} else {
    alert("Well then, if you don't want to fight, I won't fight");
}
if(clashRoyale === false) {
    alert("I lied, DIE");
} else {
    alert("Hahaha, DIE!!!");
}
var ClashRoyale = prompt("The Creator played a Pekka. What will you play? a SKELETON ARMY, a MINION HORDE, or a GOLEM").toUpperCase();
switch(ClashRoyale){
    case 'SKELETON ARMY':
        var hit = confirm("Are you sure you want to play that card?")
        if(hit === true) {
            alert("The Pekka Dies.")
            } else {
                
            }

    case 'SKELETON ARMY':
        var hit = confirm("Are you sure you want to play that card?")
        if(hit === true) {
            alert("The Pekka Dies.")
            } else {
                
            }

I need to loop the if else statement back to the first prompt.


#2

You could use a do... while loop or a for loop.


#3

How would the For loop go back to the first prompt?

Also I'm talking for the second part of code I pasted not the entire code, and I want it to loop back to

var ClashRoyale = prompt("The Creator played a Pekka. What will you play? a SKELETON ARMY, a MINION HORDE, or a GOLEM").toUpperCase();

#4

personally, I'd make it a function that calls on itself when you want it to repeat.

I didn't actually read through your entire thing when I made my first response, so sorry.

I would probably make it something like

var ClashRoyaleLoop = function(j){
var j = prompt(xxxxxxxxxxxxxxxx);
}
/* and then call on it by ClashRoyaleLoop(ClashRoyale); */

If you need any more help, don't refrain from PMing me.


#5

Ah so that's why the for loop you gave seemed to work only for the first part of it