Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Sorting out the basic knowledge points of Scala array

Shulou Source: shulou.com Published: 2022-06-02 05:18:33 09月13日 Update

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

Tags: Array knowledge knowledge point foundation method element interval sequence statement fixed length step size learning content parameter variable case parenthesis numerical value index end point Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Apple Huawei Shulou Information Microsoft