Skip to content

Tasks are done#4

Open
kostik700015 wants to merge 1 commit into
Code-the-Dream-School:masterfrom
kostik700015:ruby-collections-lesson
Open

Tasks are done#4
kostik700015 wants to merge 1 commit into
Code-the-Dream-School:masterfrom
kostik700015:ruby-collections-lesson

Conversation

@kostik700015
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@TurnerMooreDavis TurnerMooreDavis left a comment

Choose a reason for hiding this comment

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

LGTM! one small issue with leap_year

Comment thread add_up.rb
@@ -0,0 +1,19 @@
def add_up(i)
if (i.class !=Integer) || (i <1)
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 validation!

Comment thread add_up.rb
puts sum
end
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

indentation is a bit off

Comment thread full_name.rb
@@ -0,0 +1,15 @@
def Ask(question)
puts question
string = gets.chomp + " "
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

rather than adding a space to the end of the word here I would probably wait till the end of the method and just use join(' ')

Comment thread full_name.rb
full_name.push(Ask("Enter your middle name, please"))
full_name.push(Ask("Enter your last name please"))

puts "Hello " + full_name[0] + full_name[1] + full_name[2] + "!"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sorta same as the above, I would use full_name.join(' ')

Comment thread leap_year.rb
end
end

year = begin_year
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

not sure what this line is doing. begin_year is not defined at this point

Comment thread sorted_words.rb
@@ -0,0 +1,15 @@
words = []

while true do
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I try to avoid using while true loops, because then if any of the branches within that loop do not break correctly you end up with an infinite loop, which is no good

Comment thread sorted_words.rb
word = gets.chomp
if word == ''
break
elsif word.index(/[^A-Za-z]/)
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 validation!

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