Last answered:

29 May 2023

Posted on:

22 May 2023

0

why we need backlash after "a"?

I didn't understand why he put a backslash () after "a". I tried running the code without the backslash after "a", and I got the same result as he did.

1 answers ( 0 marked as helpful)
Instructor
Posted on:

29 May 2023

0

Hey Christine,


Thank you for reaching out!


The backslash after the letter 'a' helps moving the rest of the sentence on a new line (otherwise it becomes very long and hard to read).


Consider the following cases:

1. Correctly moving the code to a new line using a backslash. Note that you shouldn't have any characters on the first line after the backslah (even spaces). Otherwise, the code will return a syntax error.


2. Writing the code on a single line but leaving the backslash - here, we've introduced an unwanted backslash in the output:

 


3. Writing the code on a single line and removing the backslash between 'a' and 'fish' - this produces the same output as the one shown by Giles (case 1 above).


4. Moving the code to a new line without adding a backslash - this produces an error as we've moved the code to a new line incorrectly.


Hope this helps!


Kind regards,

365 Hristina

Submit an answer