I have this simple question actually but I can’t find the correct answer.
I would like to know how i could do something like this:
direction="-"
value=17
movement = direction value
so that it would give me: movement=-17
I know i could use an if statement but I was wordering if there is a quicker way for converting “-” to simply –
One solution from my side
It is very basic, not using anything complex, which might make it a bit unclean, but at least demonstrates that knowing just the very basic operations in ruby you can solve many tasks.