nine = while 1 do break 9 end
puts nine #=> “nine”
I love Ruby. I am not sure how I feel about this. It looks useful for the odd thing or two, maybe. nine = while 1 do break 9 end
puts nine #=> “nine”
I love Ruby. I am not sure how I feel about this. It looks useful for the odd thing or two, maybe.Again, that all could have been a side effect of horribly written Rails code where I was working. The Ruby guru I mention above would often lament about how bad our Ruby codebase was. To me, it just showed "wow it's really possible to write code this bad in this language" and left a sour taste in my mouth.
I usually prefer TypeScript for scripting things. Being able to run it via node and in the browser is a killer feature and I have many small libraries I've written that I reuse in a lot of personal projects. Sometime I use Python but I'm not a huge fan of Python's version and dependency management.
For anything that's not destined for the browser that require speed or a larger codebase (i.e. backend services) I don't think you can go wrong with the JVM. I prefer just plain Java, but also have used Scala and Kotlin extensively and they're all great for speed, collaboration, readability, testability, and have robust ecosystems.
nine = while 1; break 9; end
puts nine
And yes, it prints "9". irb(main):001:0> nine = while 1 do break 9 end
=> 9
irb(main):002:0> nine.class
=> Integer
irb(main):003:0> puts nine
9
=> nil
puts might be calling .to_s on the variable, which is why you see a string, but the loop does return an integer. 9.to_s
=> "9"I over-edited my comment to fit a narrow screen, breaking the example.