Skip to content

Practice_Atcoeder Ruby_learning #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zigzagdev opened this issue Jan 3, 2021 · 4 comments
Open

Practice_Atcoeder Ruby_learning #1

zigzagdev opened this issue Jan 3, 2021 · 4 comments

Comments

@zigzagdev
Copy link
Owner

No description provided.

@zigzagdev zigzagdev changed the title Practice_Atcoeder Practice_Atcoeder Ruby_learning Jan 5, 2021
@zigzagdev
Copy link
Owner Author

gets.chomp.to_i method can't use four arithmetic operations(f.e add, subtract).

so, if you want to use those, must change to gets.split.map(&:to_i) insted of gets.chomp.to_i.

@zigzagdev
Copy link
Owner Author

The method that name is case(when) can omitted in 1 line.

case gets.chomp when "A"
puts "B" else
puts "C" end

into

puts gets.chomp == 'A'? 'B':'C'

@zigzagdev
Copy link
Owner Author

Array method can't use this method gets.chomp.split.map(&:to_i), but you can use this method get.split.map(&:to_i).←this method allows you to put params into each array.

@zigzagdev
Copy link
Owner Author

Different for in each in how to use these method.
・former gets the element's number but later gets element's object. So, if you want to use the objects, you have to use later one. And then assign it into variable. Check it whether it is assigned into variable using command p .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant