Module 1 Lesson 7

Hi All,

Super beginner here! I am completing the Module 1 Lesson 7 activity and had a question in regards to the solutions. This is really bugging me and I need to get a clear understanding of this or I’m afraid I’ll run into more confusion later down the line so I need to nip this in the bud now.

When completing the question below, my solution was to create a new variable within the liftOff function to capture the result of fuelLevel - 50. However, when I check the solution for this problem, instead of creating a new variable, Chris used the same variable (fuelLevel) already created and used the mathematical operator -= to get the result of fuelLevel - 50. My question is,

  1. Is my solution wrong?
  2. If not, is it okay to do it this way since it will give me the same result in return?

Thanks in advance!

Inside the “liftOff” method, write code that will:

  • • Decrement the fuelLevel property by 50.

  • • Print to the console “We have lift off!”.

  • • Print the current fuelLevel to the console.

  • • Use a message like “Current Fuel Level at: X” where X is the actual value of the fuelLevel property.

  • • Hint: Substitute dynamic values into strings using “(fuelLevel)” inside the string.

func liftOff() {

    // Decrement by 50
    fuelLevel -= 50
    // Print statements
    print("We have lift off!")
    print("Current Fuel Level at: \(fuelLevel)")


func liftOff() {

    var currentFuelLevel = fuelLevel - 50
    print("We have lift off!. Current fuel level at \(currentFuelLevel)")


I guess the point here is there is no need to create another variable since the idea is to decrement the fuelLevel value using the -= notation.

It’s a learning process so don’t stress if your solution differs to the solution provided by Chris Ching. As you gather experience you will figure out ways of coding that others might do differently. It does not mean you are wrong if you arrive at the same answer. All good I reckon.

1 Like

Thanks, Chris. This was super helpful. Appreciate it!