Difference between 4 % 2 and 4 %2
-
Does anyone know why 4 %(space)2 works, but 4 %(no space)2 raises a syntax error (if it's in a file)?
Also, why does 2 -1 work, and 2.to_f - 1 works, but 2.to_f -1 doesn't?
-
Id guess its to do with how ruby expects to receive arguments for the method. If you put brackets around it it should work, i.e.
4%(2)and2.to_f-(1)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement