Which coding languages are you comfy in these days?

I have a feeling that Python will turn out to be easiest common denominator to use for code examples here at this point in time (which is a little sad to me because I have a strong preference for Ruby but I don’t want to be a stick in the mud—I will happily explain Ruby to anyone who wants to know more about it though, it’s really fun!! :stuck_out_tongue: ). GDScript seems very similar to Python so I would hope that code examples in Python would still be fairly accessible to a GDScript user. The most significant difference might be their stdlibs—I’ve written significantly more Python than GDScript so I might be wrong but that’s definitely the impression I get.

Actually, @hellojed, does this example make sense to you? It’s a simple Python 3 program with no error checking or anything.

import sys

cols = int(sys.argv[1])
rows = int(sys.argv[2])

outp = []

for i in range(rows):
    for j in range(cols):
        outp.append('*')
    outp.append("\n")

print(''.join(outp), end="")

You use it like this at the shell:

% python box.py 5 3
*****
*****
*****

(As a side note, just to gesture at what I like so much about Ruby, here’s the identical program in Ruby:

cols = ARGV[0].to_i
rows = ARGV[1].to_i

outp = []

rows.times do
  cols.times { outp << '*' }
  outp << "\n"
end

print outp.join
% ruby box.rb 9 4
*********
*********
*********
*********

Not too hard to read, eh, even if you don’t know Ruby perhaps…??)

2 Likes