Some small knowledge points about ruby

About arrays

arr = [1,2,2,3,4,]

  1. Get the minimum value in the array
 a.min => 1
  1. Get an array that does not contain duplicate elements
a.uniq => [1,2,3,4]

About numbers

a = 132113.2233

  1. Keep decimal places
a.round(2) => 132113.22  #自动进行四舍五入换算

Being added in time

Guess you like

Origin blog.csdn.net/weixin_42656358/article/details/102546763