In the following script, which line(s) will cause an error(s)?

✅  The correct answer is:

Line 7 and 8 will cause an error. Line 7 has whitespace in $will i work and should be $will_i_work. Line 8 cannot start with a number befcause it is a variable.

Question:

In the following script, which line(s) will cause an error(s)?

Solution:

  • Line 6 will cause an error because you can’t reassign a new value to a variable that has already been set.
  • Line 7 and 8 will cause an error. Line 7 has whitespace in $will i work and should be $will_i_work. Line 8 cannot start with a number befcause it is a variable.
  • Line 5 will cause an error because some_string should be someString.
  • Line 3 and 4 will cause an error because a variable cannot start with an underscore(_).