Ask coding questions

← Back to all posts
Why does my game all of the sudden clear without a Console.Clear() method?
CDSWgrimly

My game wants to clear the console and not work for some reason after I input my name

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
CDSWgrimly
Comments
hotnewtop
Coder100

yes you added a console.clear

also, the other code won't ever run because it is inside an if statement that checks if the melee health is <= 0, which isn't true.

CDSWgrimly

@Coder100 I guess I should've worded this differently. The code past line 100 worked before, now it wants to clear without a console.clear statement. The line you are mentioning is at the end of a loop where the enemy has been defeated. The clear is after the loop for a single fight has been completed

Coder100

No, you put all the code in an if statement that won't run, look at line 105 @ConnorGrim

CDSWgrimly

@Coder100 Ok, i just needed to move a curly bracket, and now it works

Coder100

nice!
mark as correct answer please @ConnorGrim

Coder100

so next time check for correct code placement

CDSWgrimly

This is confusing because I never touched the code and then it started not working with me