Is this an imperative sentence?
Is this sentence an imperative sentence, or does it have conditional meaning?
You hang around with riffraff like the Weasleys and that Hagrid, and it’ll rub off on you.
It's a complex situation.
Sentences like the presenting one are clearly intended to urge, if not impose, some kind of behavior on the addressee (though the addressee in this case is only a generic you, the same sense as one, but faluting a couple levels lower).
So in that they are like imperatives. However, it can be shown (as I do in my paper) that they aren't real imperatives, syntactically. They must be a different construction, mimicking an imperative. It's clear that the construction does have some conditional meaning --
- (If) you hang around with riffraff like the Weasleys and that Hagrid,
- (Then) it’ll rub off on you.
which is the beginning of a Modus Ponens syllogism:
- ((p Implies q) And p) Implies q | ((p ⊃ q) ⋀ p) ⊃ q
The second line is implied in context, and the conclusion follows.
An extreme case of this is
- Buy 10 and Save! (almost always with an exclamation point)
which means something like (boldfaced omissions)
-
If you buy 10
[count noun]
s, then you will save some money.
It could conceivably be read as an imperative (or, more correctly, an impositive as John Lawler explains in the comments):
[Go and] hang around with riffraff like the Weasleys and that Hagrid, and it’ll rub off on you.
But given the context, it's unlikely that the speaker meant it as a command. (After all - who would command someone to go get bad influences from riffraff?) It's more likely to be interpreted as a conditional:
[If] you hang around with riffraff like the Weasleys and that Hagrid,
andit’ll rub off on you.