Scala – Add your own method to String class
Sometimes, if existing methods does not solve your purpose, you can add your own method into string class. Scala allows you to add a method easily. Example – Suppose you want to create a...
Software Programming Guide
Sometimes, if existing methods does not solve your purpose, you can add your own method into string class. Scala allows you to add a method easily. Example – Suppose you want to create a...
In the previous post, we have learnt about string literal and its basic functions in scala. In this post, we will see a concept called String interpolation introduced in scala version 2.10 that helps...
Scala string is a sequence of characters inside quotes. It is an immutable object like in java that means its values can not be modified. When you write a String in REPL (Read-Evaluate-Print-Loop) environment,...
In Scala, a function whose return value depends on one or more variables declared outside the function, is called as closure.In other term, we can say that function and variable declared outside are bound...
In Scala, we can write the function with default parameters as we have seen in the last post.Now, we will see how to pass parameters with some name. We can pass named parameters in...
In Scala, we have seen how to pass the function as parameter. Now, Suppose you want to define your function in such a way that if you don’t pass any arguments, it gives you...
In Scala, we can pass a function as a parameter to another function or say method. For that we have to follow the below guidelines. Define your method , including the function signature that...
In Scala, a function defined inside another function is called nested function or local function. This feature is not supported by Java. In other languages, we can call a function from another function but...
In Scala, Recursion is an important concept in pure functional programming language.By definition, Recursive function is a function which calls itself. We need to to be careful while using recursive functions, because program may...
In scala, when a function accepts another function as an argument or returns a function as an output, is called Higher order function. Let’s understand this with examples. Example1 Map is the good example...