This time as a study of Python and Ruby I would like to compare the grammar of instance methods. Instance methods are the basic content of object-oriented programming. I would like to compare in various languages.
The Python and Ruby used this time are implemented in the following versions. Python: 3.7.4 Ruby: 2.6.3
test.py
class Test:
def __init__(self):
print('During study')
test.rb
class Test
def initialize
puts('During study')
end
end
When compared, I get the impression that the presence or absence of ":" and "end" is different.
We will update it from time to time.
Recommended Posts