ysyx*:0001:Scala & Chisel

Scala
val
for immutable,var
for mutable- need
{}
to define a block of code - if condition need
()
if block return value, it will be the last line of the selected block - function definition:
def funcName(param1: Type1, param2: Type2): ReturnType = { ... }
def
could indef
(local function)
return value is the last line of the block List
is scheme like (head, tail)- for loop:
for (i <- 1 to 10) { ... }
to
[left, right] (inclusive)until
[left, right) (exclusive)by
step lenfor (value <- randomList) { ... }
iterate over iterable import A.B._
orimport A.B.{C, D}
- OOP: like python, the class block is the constructor
s"string $var, ${var1 + var2}"
string interpolation
- Post title:ysyx*:0001:Scala & Chisel
- Post author:Jackcui
- Create time:2023-08-19 11:18:23
- Post link:https://jackcuii.github.io/2023/08/19/ysyx0009/
- Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.
Comments