145k views
10 votes
Which line of code correctly compares the dragon’s life force to the player’s life force?

when dragon = player:

when dragon + player:

if dragon = player

if dragon > player:

User CrazyMax
by
4.4k points

1 Answer

7 votes

Answer:

If dragon = player

In coding, the = sign is used to compare things and values, or when doing an arithmetic / mathematical equation. The if statement can run a condition one to infinite times as long as the statement is true. Unlike a while statement, the if statement is a boolean related comparison that does not count as a loop. Don't forget them when making true or false statements, if needed!

-learning code with potato

User Joekr
by
5.0k points