“Шпаргалка рубина” Ответ

Шпаргалка рубина

Four good ruby cheat Sheets:
https://overapi.com/ruby
http://www.testingeducation.org/conference/wtst3_pettichord9.pdf
https://github.com/ThibaultJanBeyer/cheatsheets/blob/master/Ruby-Cheatsheet.md#basics
https://www.vikingcodeschool.com/professional-development-with-ruby/ruby-cheat-sheet
DevLorenzo

Лучший шпаргалка рубина

gets # is the Ruby equivalent to prompt in javascript (method that gets input from the user)
gets.chomp # removes extra line created after gets (usually used like this)
DevLorenz02

Лучший шпаргалка рубина

10.times do
  print “this text will appear 10 times”
end
DevLorenz02

Лучший шпаргалка рубина

things.each do |item| # for each things in things do something while storing that things in the variable item
  print “#{item}"
end
DevLorenz02

Лучший шпаргалка рубина

class DerivedClass < BaseClass; end # if you want to end a Ruby statement without going to a new line, you can just type a semicolon.

class DerivedClass < Base
  def some_method
    super(optional args) # When you call super from inside a method, that tells Ruby to look in the superclass of the current class and find a method with the same name as the one from which super is called. If it finds it, Ruby will use the superclass' version of the method.
      # Some stuff
    end
  end
end

# Any given Ruby class can have only one superclass. Use mixins if you want to incorporate data or behavior from several classes into a single class.
DevLorenz02

Лучший шпаргалка рубина

my_array = [a,b,c,d,e]
my_array[1] # b
my_array[2..-1] # c , d , e
multi_d = [[0,1],[0,1]]
[1, 2, 3] << 4 # [1, 2, 3, 4] same as [1, 2, 3].push(4)
DevLorenz02

Ответы похожие на “Шпаргалка рубина”

Вопросы похожие на “Шпаргалка рубина”

Смотреть популярные ответы по языку

Смотреть другие языки программирования