# 4 Started Ruby "Fun Ruby 6th Edition" Part 2 Learn the basics Chapter 4 Objects and variables / constants

This is the starting line w Up to 3 times was preparation and overview. This is the first step in learning the program.

4-1 Object P.77

value.

4-2 Class P.78

Object attributes

4-3 Variable P.79

Algebra: Object name tag

4-4 Constant P.82

Algebra 2: Object name tag

4-5 Reserved words P.85

Classes and reserved words cannot be variables or constants. Those with usage restrictions.

4-6 Multiple assignment P.84

Swapping variables

Aset,Bset = "Kimchi","Oshinko"
tmp=Aset
Aset=Bset
Bset=tmp
p [Aset,Bset]

It can be handled with 1: many instead of 1: 1. That's the basics of DB.

It is also good to temporarily save it in the replacement tmp. But if you use multiple assignment, one line is OK.

Aset,Bset = "Kimchi","Oshinko"
Aset,Bset=Bset,Aset
p [Aset,Bset]

This is convenient.

Extract elements of an array

set=["Oshinko, miso soup","Kimchi, miso soup"]
Aset,Bset=set
p Aset
p Bset

You can decide on a variable and assign it later. It would be nice to be able to do this kind of thing.

comment

I thought it was one item a day, but since the content is deep and I have to work to practice the guitar and earn living expenses, I will do one item in a few days and one week for difficult content. So I will learn slowly and relaxedly w Then, there are up to 23 chapters of "Fun Ruby", so it will take about half a year or a year at the shortest. I feel that it is late to do the qualification problem collection from there, so I think that it will be one year after studying until the qualification acquisition and the exam study, assuming that I will incorporate the qualification problem collection on the way.

Well it's not easy. Well, I wonder why it starts from 0. How many years will it be before we can make an actual app? Well, if you study until you can get a qualification, I think that the rest is copy and paste, but w Even so, I think that Javascript will be the next one, so there are differences in syntax and description, so I'd like to explore that as well. It's not easy, it's difficult as it is, but I don't have to worry about it yet. Let's do our best. If you learn the basics well and hold it down, you will be able to do something unexpectedly.

Recommended Posts

# 4 Started Ruby "Fun Ruby 6th Edition" Part 2 Learn the basics Chapter 4 Objects and variables / constants
# 5 Started Ruby "Fun Ruby 6th Edition" Part 2 Learn the basics Chapter 5 Conditional judgment Created in Hanoi
# 3 Started Ruby "Fun Ruby 6th Edition" Chapter 3 Command Line and File Reading
Java engineers now compare to learn the basic grammar of Ruby Part 1 (Basic, Variables)
[Ruby basics] I tried to learn modules (Chapter 1)
[Ruby] Class nesting, inheritance, and the basics of self