Set default value for function parameter in scala
I am trying to set a default value to an anonymous function in scala and
so for not able to find any solution. Hope some one would help me out in
SO.
I have the following structure,
case class A(id:Int = 0)
case class B(a:A)
object B {
def func1(f:Int = 0)={
........
}
def func2(f:A => B = (how to give default value ?))={
case Nothing => {
//do something....
}
case _ => {
//do some other thing......
}
}
}
Basically, I want to make passing the parameter as optional. How can I
achieve this?
No comments:
Post a Comment