Conversation
| puts 'BASE and depth must be positive. ' | ||
| exit | ||
| end | ||
| tree(number.to_i,base_number.to_i) |
| puts "Depth?" | ||
| number = gets.chomp | ||
| base_number = ENV['BASE'] | ||
| if number.to_i <= 0 || number.nil? || base_number.to_i <=0 |
There was a problem hiding this comment.
Surrounding space missing for operator <=.
| } | ||
| end | ||
|
|
||
| puts "Depth?" |
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
| else | ||
| puts "#{i+1}:" + "#{str}".center(pr[1].to_i) | ||
| end | ||
| } |
There was a problem hiding this comment.
} at 26, 4 is not aligned with (0...n).each{ |i| at 6, 2.
| puts "#{i+1}:" + "#{str}".center(pr[1].to_i) | ||
| puts" " + "#{str_end} \\".center(pr[1].to_i) | ||
| else | ||
| puts "#{i+1}:" + "#{str}".center(pr[1].to_i) |
There was a problem hiding this comment.
Move puts "#{i+1}:" + "#{str}".center(pr[1].to_i) out of the conditional.
Surrounding space missing for operator +.
Prefer to_s over string interpolation.
| str2 = [' /'] | ||
| str1 = ' /' | ||
| (0...i).each{|j| | ||
| temp = temp * (i - s + 1)/s |
There was a problem hiding this comment.
Use 2 (not 0) spaces for indentation.
Surrounding space missing for operator /.
| s = 1 | ||
| str2 = [' /'] | ||
| str1 = ' /' | ||
| (0...i).each{|j| |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
Avoid using {...} for multi-line blocks.
Unused block argument - j. You can omit the argument if you don't care about it.
| puts "Pascal triangle".center(pr[1].to_i) | ||
| (0...n).each{ |i| | ||
| trn=[base_number] | ||
| temp=base_number |
There was a problem hiding this comment.
Surrounding space missing for operator =.
| pr= TermInfo.screen_size | ||
| puts "Pascal triangle".center(pr[1].to_i) | ||
| (0...n).each{ |i| | ||
| trn=[base_number] |
There was a problem hiding this comment.
Use 2 (not 0) spaces for indentation.
Surrounding space missing for operator =.
| def tree(n,base_number) | ||
| pr= TermInfo.screen_size | ||
| puts "Pascal triangle".center(pr[1].to_i) | ||
| (0...n).each{ |i| |
There was a problem hiding this comment.
Space missing to the left of {.
Avoid using {...} for multi-line blocks.
| else | ||
| puts "#{i+1}:" + "#{str}".center(pr[1].to_i) | ||
| end | ||
| } |
There was a problem hiding this comment.
} at 26, 4 is not aligned with (0...n).each { |i| at 6, 2.
| trn.push temp | ||
| s += 1 | ||
| str2.push str1 | ||
| } |
There was a problem hiding this comment.
} at 17, 6 is not aligned with (0...i).each { at 12, 4.
| str2 = [' /'] | ||
| str1 = ' /' | ||
| (0...i).each { | ||
| temp = temp * ((i - s + 1) / s) |
There was a problem hiding this comment.
Use 2 (not 0) spaces for indentation.
Use self-assignment shorthand *=.
|
|
||
| def tree(n,base_number) | ||
| pr = TermInfo.screen_size | ||
| puts "Pascal triangle".center(pr[1].to_i) |
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
| } | ||
| str = trn.join(' ') | ||
| str_end = str2.join(' \\') | ||
| puts "#{i + 1}:" + "#{str.to_s}".center(pr[1].to_i) |
There was a problem hiding this comment.
Prefer to_s over string interpolation.
Redundant use of Object#to_s in interpolation.
Trailing whitespace detected.
| k = 0 | ||
| str2 = [' /'] | ||
| str1 = ' /' | ||
| (0...i).each { |
There was a problem hiding this comment.
Avoid using {...} for multi-line blocks.
| trn = [base_number] | ||
| temp = base_number | ||
| s = 1 | ||
| k = 0 |
There was a problem hiding this comment.
Useless assignment to variable - k.
| str2 = [' /'] | ||
| str1 = ' /' | ||
| (0...i).each do | ||
| temp = ( (temp * (i - s + 1)) / s ) |
There was a problem hiding this comment.
Space inside parentheses detected.
| trn = [base_number] | ||
| temp = base_number | ||
| s = 1 | ||
| c = 0 |
There was a problem hiding this comment.
Useless assignment to variable - c.
| s += 1 | ||
| str2.push str1 | ||
| end | ||
| c = 1 |
There was a problem hiding this comment.
Useless assignment to variable - c.
Xanderwot
left a comment
There was a problem hiding this comment.
В основном замечание по именам переменных
| def tree(n, base_number) | ||
| pr = TermInfo.screen_size | ||
| puts 'Pascal triangle'.center(pr[1].to_i) | ||
| (0...n).each do |i| |
| require 'terminfo' | ||
|
|
||
| def tree(n, base_number) | ||
| pr = TermInfo.screen_size |
There was a problem hiding this comment.
очень плохое имя для переменной и ниже тоже это прослеживается
| s = 1 | ||
| str2 = [' /'] | ||
| str1 = ' /' | ||
| (0...i).each do |
| number = gets.chomp | ||
| base_number = ENV['BASE'] | ||
| if number.to_i <= 0 || number.nil? || base_number.to_i <= 0 | ||
| puts 'BASE and depth must be positive. ' |
There was a problem hiding this comment.
я считаю что в данном случае лучше райзить ошибку, нежели просто завершать выполнение программы
| puts 'Depth?' | ||
| number = gets.chomp | ||
| puts 'BASE?' | ||
| base_number = gets.chomp |
| puts 'Depth?' | ||
| number = gets.chomp | ||
| base_number = ENV['BASE'] | ||
| while number.to_i <= 0 || number.nil? || base_number.to_i <= 0 do |
There was a problem hiding this comment.
Do not use do with multi-line while.
| s += 1 | ||
| branch.push ' /' | ||
| end | ||
| arrToStr = trn.join(' ') |
There was a problem hiding this comment.
Use snake_case for variable names.
| number = gets.chomp | ||
|
|
||
| end | ||
| while base_number.to_i <= 0 do |
There was a problem hiding this comment.
Do not use do with multi-line while.
| base_number = gets.chomp | ||
| end | ||
| tree(number.to_i, base_number.to_i) | ||
|
|
| break if number.to_i > 0 | ||
| end | ||
| end | ||
| if base_number.to_i <=0 |
There was a problem hiding this comment.
Surrounding space missing for operator <=.
| puts 'Depth?' | ||
| number = gets.chomp | ||
| base_number = ENV['BASE'] | ||
| if number.to_i <= 0 |
| base_number = gets.chomp | ||
| break if base_number.to_i > 0 | ||
| end | ||
| end |
| break if number.to_i > 0 | ||
| end | ||
| end | ||
| if base_number.to_i < =0 |
| number = gets.chomp | ||
| break if number.to_i > 0 | ||
| end | ||
| end |
| puts 'Depth?' | ||
| number = gets.chomp | ||
| base_number = ENV['BASE'] | ||
| if number.to_i < = 0 |
new homework 1 corrected homework 1 corrected-new homework 1 corrected-new1 homework 1 corrected-new2 homework 1 corrected-new3 homework 1 corrected-new4 homework 1 corrected-new5 homework 1 corrected-new6 homework 1 corrected-new7 homework 1 right i homework 1 right i homework 1 right i homework 1 corrected commit1 commit2 corrected corrected1 corrected corrected
Фамилия Имя
Бондарева Юля
Email
y.d.bondareva@inbox.ru
Номер домашнего задания
1
Ссылка на видео с демо работы
https://www.youtube.com/watch?v=FW_AysccL-M
Комментарии
сделала 3 задания