"hello" - 1 Answer

Hi guys! I dont understand why “hello” -1 is an invalid answer on the section 2 quiz. I watched the course twice and I’m obviously missing something. Can someone explain?

“Hello” +1 would concatenate the string and the int, the end result would be a string “Hello1”

“Hello” -1 is an invalud expression because you are trying to perform a mathematic operation on a string value. e.g. you cannot deduct the value of 1 from a word (string).

Hope this helps.

See also;

Privacy & Terms