650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6F/91/wKioL1WhEYHR0V55AAi8dfKDnAg782.jpg "title=" 002- Scala function definition, Process Control, exception handling get started in combat. png "alt=" wkiol1wheyhr0v55aai8dfkdnag782.jpg "/>
002-scala function definition, Process Control, exception handling getting started combat
Scalafunction Definitionstatement end no semicolondefining an parameterless functionDefFunction Name(Parameter name:parameter Type) [: unit=]{function Body}The teacher's code My actual code
The reason is that the integrated development environment comes with a version of 2.11.0variablesConstants(not variable)StatementValVariable DeclarationVarno reference function calls without parentheses()defines a function with the return value of a parameterDefFunction Name(Parameter name:parameter Type...):return value type={function Body}Teacher Code
Note that the last one is b .
is the return value of this function
default last behavior return valueProcess ControlIfStatementif (!args.isempty) file=arg (0)streamlined syntax structureprintln (if (!args.isempty) args (0) Else "Spark.txt") Do{}while ()Looping StatementsaboveForStatementfor (I <-1 to ten) {}for (i <-1.to (10)) {}+-*/%Print all file statements for the current directoryException HandlingOpenFile (file)may produce an exceptionwith theJavasamesame Usetry{}catch{}finally{}Way to handlewith theJavadifferentthroughCasematch a different exceptionNote The order of exceptions
Welcome to the vast number of enthusiasts to learn and exchange. Also welcome to join the study enthusiasts
DT Big Data Dream Factory Exchange Group: 462923555
DT Big Data public account: Dt_spark
Video Watch Links
http://www.tudou.com/plcover/Yy5F5gsurSE/
Scala Classic-----002-scala function definition, Process Control, exception handling getting started combat