How to execute a function in apache-scala

0 votes

Can anyone show anyone function execution in scala?

Jul 1, 2019 in Apache Spark by zunaid

recategorized Jul 4, 2019 by Gitika 248 views

2 answers to this question.

0 votes

Hi,

Here is a simple example of how you can execute a function in Scala, for this you need to write one function in Scala shell below:

scala> println("Any text")

Here is a simple example solved with the output:

Hope it helps.

answered Jul 1, 2019 by Gitika
• 65,970 points
0 votes
Function Definition :

def test():Unit{

var a=10

var b=20

var c=a+b

}

calling function : test
answered Aug 5, 2020 by Ramkumar Ramasamy

Hey,

Thank you for your contribution to the Edureka Community.

Register/Sign up on the community to gain points for further contributions. You may ask questions, answer, upvote, and downvote an answer. Each of these would fetch you points and you could be among the top contributors and win exciting merchandise from Edureka.

Cheers!

Related Questions In Apache Spark

0 votes
1 answer

How to append a list in Scala?

Hey, For this purpose, we use the single ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 65,970 points
3,821 views
0 votes
1 answer

How to search for a Key in a Scala Map?

Hey, The Map.contains() method will tell you if ...READ MORE

answered Jul 29, 2019 in Apache Spark by Gitika
• 65,970 points
198 views
0 votes
1 answer

How to format a string in Scala?

Hey, To format a string, use the .format ...READ MORE

answered Jul 31, 2019 in Apache Spark by Gitika
• 65,970 points
209 views
0 votes
1 answer
0 votes
1 answer

How to get the number of elements in partition?

rdd.mapPartitions(iter => Array(iter.size).iterator, true) This command will ...READ MORE

answered May 8, 2018 in Apache Spark by kurt_cobain
• 9,390 points
954 views
0 votes
1 answer

How to calculate the result of formula with Scala?

Hi, You can use a simple mathematical calculation ...READ MORE

answered Jul 1, 2019 in Apache Spark by Gitika
• 65,970 points
438 views
0 votes
1 answer

error:error: only classes can have declared but undefined members.

Hi, This happens in Scala whenever you won't ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 65,970 points
778 views
0 votes
1 answer

How to write a Scala program in script mode?

Open notepad and add the following code ...READ MORE

answered Nov 16, 2020 in Big Data Hadoop by Gitika
• 65,970 points
202 views
0 votes
1 answer

How to check if a particular keyword exists in Apache Spark?

Hey, You can try this code to get ...READ MORE

answered Jul 23, 2019 in Apache Spark by Gitika
• 65,970 points
1,890 views
0 votes
1 answer

How to use nested function in Scala?

Hey, With Scala, we can define a Scala ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 65,970 points
310 views