1. Variables (1) Three ways to define variables: 1) val refers to define an immutable variable; scala> val x = 10 x: Int = 10 scala> x*x res4: Int = 100 scala> res4 + 1 # use result as a value res6: Int = 101 scala> res4 + res6 res7: Int = 201
package com.dt.spark.scala.bascis class Dataframework case class Computerframework (name:String,popular:Boolean) extends Dataframework case class Storgeframework (name:String,popular:Boolean) extends Dataframework object helloPatternMatch { def main(