Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sorting out the basic knowledge points of Scala array

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "Scala array of basic knowledge points collation", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Scala array basic knowledge points collation" bar!

# # fixed length Array

Arrays generally include fixed-length arrays and variable-length arrays, which are declared using Array in Scala

Note: the index of scalad is marked with parentheses () rather than square brackets [] commonly used in other languages, and the index subscript starts at 0.

/ / declare an array of string type, with a length of 3, set a value for each element, and access the second element by index. Val a = new Array [String] (3) a (0) = "abc" a (1) = "edf" a (2) = "qaz" println (a (1))

The abbreviation of the array

Val a = Array ("1", "2", "3") println (a (1))

Traversal of array

Val list = Array ("5", "2", "3", "4") for (x

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report