I’ve started to learn ruby, because it seems as if the only reasonable web development environment today is ruby on rails. And apparently I’m starting to like the language. It’s syntax is so simple, it’s almost pseudo-code, this is especially handy when you use the interactive console.

Let’s have an example:

First a simple session in python:
>>> def hello(arg):
... print "Hello %s" % arg
...
>>> hello("world")
Hello world
>>> hello "world"
File "“, line 1
hello “world”
^
SyntaxError: invalid syntax
>>>

Unfortunatly when you try to call a function without the brackets, it won’t work.

The same thing in ruby:
irb(main):001:0> def hello(arg)
irb(main):002:1> puts "Hello %s" % arg
irb(main):003:1> end
=> nil
irb(main):004:0> hello "World"
Hello World
=> nil
irb(main):005:0>

surprisingly it works. That’s nice, somehow it feels much more like a real “command-line”.

-Richard

Tags Development, Rant

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image