---
title: "ruby中星号的使用"
author: "biyeah"
date: "2011-12-20T05:54:37Z"
tags: []
categories: ["编程语言"]
slug: "ruby"
draft: false
lastmod: "2011-12-20T05:54:37Z"
id: 1317280
url: "https://biyeah.iteye.com/blog/1317280"
---

ruby中星号的使用


1、数字乘法 2 * 3 = 6
2、幂 10**2 = 100 (星号之间不能有空格)
3、字符串扩展 'foo' * 2 = 'foofoo'
4、数组的扩展 ]]*2 = ],1,2,]]
5、创建数组  *a = 1,3,"as"
    a = 
6、数组参数传入时的前缀 a= 
    testFun(*a) == testFun(1 , 2) != testFun()
7、还没发现..