大佬教程收集整理的这篇文章主要介绍了Bash : 索引数组,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
一个索引数组。
一个索引数组。
{} 符号。请注意,索引数组的下标从 0 开始,且不能为负数(真希望所有编程语言中的数组元素都从 0 开始索引!)。
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/d46fcbc81ff77807c05ff4ff636de068.png" >
值的元素呢?不用担心,这里没有程序崩溃的问题,只不过没有输出内容而已:
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/087f03a90157860c392136bf43ca8abb.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/b81b490da53a507410be8c93388cf3e7.png" >
可以获取到所有已经赋值元素的下标进行查看:
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/89a5c064fa2c58dd055b1211116835ad.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/10302f94d7a13d45f4d368e2d702493e.png" >
会发生什么?
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/492f63bf66c49cd5eb2bb87cb6e50104.png" >
在数组的尾部添加新的元素(严谨点说,这应该是队列的一个特征!):
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/f087ef71fb925c737f1a522cd6db675f.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/a01b25b25665b1e4d77873d4493b05dc.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/86a1367250080057cb6369aed7475645.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/70f8ceb908af1d15d7391992f7e5bc1d.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/63f4c9566d9d3c9bf67be499d88a00c7.png" >
可以获取到某个元素的长度:
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/3cb6b4c964478d67e23999aa5bc47715.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/ef31508c5e530463e0353e2c5743c8e2.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/9f8cc73a37ba206733184a69fe0bd5b0.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/cdeb1880a1631f27336c80ea1a08b966.png" >
title="Bash : 索引数组" alt="Bash : 索引数组" src="https://cn.js-code.com/res/2019/02-09/09/b035750474d6eBACdecefd5a2dfe6c39.png" >
以上是大佬教程为你收集整理的Bash : 索引数组全部内容,希望文章能够帮你解决Bash : 索引数组所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。