17

I have a colleague who keeps confusing slashes "slash" and "backslash" (As in: "Should I escape such-and-such with a slash?" My answer: "No.")

I'm trying to teach him the difference but so far just telling him the name of the symbol doesn't seem to stick. That's why I'm trying find a good mnemonic to help him remember, but I can't think of one.

I have seen the following:

/ is like a guy leaning forward
\ is like a guy leaning BACKward

But that requires you to remember that the guy is facing right, which just shifts the burden of remembering one arbitrary datum to remembering another arbitrary datum. (Case in point: when I told him that mnemonic, his response was "Oh yes, I see. But that only works if I remember that the guy is walking to the left." D'oh!)

So, is there a more easily remembered mnemonic for slash-vs-backslash? Perhaps one that relates to real-world experience?

rix0rrr
  • 9,856
  • 5
  • 45
  • 48
  • 2
    Do you work in a left-to-right locale (Europe, America etc) or a right-to-left (I think Israeli)? – Joe Jan 24 '11 at 16:15
  • 2
    I always refer to the top end of the actual slash character, whether its leaning to the beginning of a sentence(\\) or the end of a sentence(/) – brett Jan 24 '11 at 16:16
  • 1
    @Joe - his profile says Holland. – Oded Jan 24 '11 at 16:16
  • 2
    I remember it because Unix uses / and Microsoft decided to do it backwards. (Unix used / for directories in 1970. In 1981 Microsoft DOS 1.0 didn't have directories and they chose to use slash for switches. DOS 2.0 included directories and didn't want to change the switch character, and so they used the backslash character. – Chelmite Jun 12 '15 at 16:38
  • 3
    I'm voting to close this question as off-topic because, as interesting as it is, it is not really about programming. – halfer Apr 17 '17 at 21:07

6 Answers6

23

On my keyboard, the BACKslash key is right below the BACKspace key.

And slaSH is right next to SHift.

Gabe
  • 84,912
  • 12
  • 139
  • 238
16

Use this: A line was standing up. If it fell forwards, it's a forward slash, if it fell backward it's a backslash.

Hugh Jass
  • 161
  • 1
  • 2
  • this is the best sofar, imho, its really easy to remember since gravity and the notion of standing up are quite universal at least on most planet surfaces. – Nikole Jul 17 '18 at 12:25
  • As mentioned by OP, it will only work if line is facing right. – dheerendra May 16 '23 at 06:21
7

The top of a backslash points to the back. (when reading left-to-right, as English is read)

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
4

Backslash leaning backwards is pretty much the usual mnemonic as far as I know. It helps if you remember you type from left to right, and then the cursor always moves right - facing right.

mrbellek
  • 2,300
  • 16
  • 20
3

In regular English usage, the forward slash is a common shorthand for "or" and is used in fractions, and the backslash isn't used at all. So it may help to remember where they're used and why.

Reinderien
  • 11,755
  • 5
  • 49
  • 77
2

If you are writing on a piece of paper and put your pen on the line and go forward and up to make the slash, it is a forward slash.

Mike
  • 21
  • 1