Skip to content

Ruby collections lesson (Lesson 2.1)#8

Open
Dan88Hus wants to merge 2 commits into
Code-the-Dream-School:masterfrom
Dan88Hus:ruby-collections-lesson
Open

Ruby collections lesson (Lesson 2.1)#8
Dan88Hus wants to merge 2 commits into
Code-the-Dream-School:masterfrom
Dan88Hus:ruby-collections-lesson

Conversation

@Dan88Hus
Copy link
Copy Markdown

@Dan88Hus Dan88Hus commented Nov 1, 2021

No description provided.

Comment thread full_name.rb
@@ -0,0 +1,28 @@
# (1) Write a program which asks for a person's first name, then middle, then last. It should store each of these parts in an array. Finally, it should greet the person using their full name. Call the program full_name.rb.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of a Ruby hash for storing data.

Comment thread leap_year.rb
array.each do |i|
if i % 400 == 0
puts i.to_s + ' is leap year'
elsif i % 4==0 && i % 100 != 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch for the indentation here, make sure all lines are aligned in the block.

Comment thread sorted_words.rb
break if not swapped
end

array
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice old-fashion way of sorting array elements.

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

Successfully merging this pull request may close these issues.

2 participants