Scala中的评论

Scala评论 (Scala comments)

Comments are things that are readable by the programmer. They are added to the code to add an explanation about the source code. Commenting on a program to make it easier to understand by the programmer.

注释是程序员可以读取的东西。 它们被添加到代码中以添加有关源代码的说明。 对程序进行注释,使程序员更易于理解。

In Scala also comments are available. The comments in Scala are same as C++, Java and many other popular programming languages.

在Scala中,也提供注释。 Scala中的注释与C ++,Java和许多其他流行的编程语言相同。

There are two types of comments that can be added to a program:

可以将两种类型的注释添加到程序中:

  1. Single-line comment

    单行注释

  2. Multiline Comment

    多行注释

1)单行注释 (1) Single line comment)

It is the comment that has a span of an only single line. The line in which comment is started is commented.

该注释的跨度只有一行。 开始注释的行被注释。

Syntax:

句法:

    // Single line code to be commented...

2)多行注释 (2) Multiline comment)

A multiline comment can span up to many lines based on its end literal. A multiline comment starts and ends with a literal and all the code inside that literal is treated as a comment.

根据多行注释的结束文字,它最多可以包含多行。 多行注释以文字开头和结尾,该文字内的所有代码均被视为注释。

Syntax:

句法:

    /* 
Multiline
Code to be commented 
*/

Scala评论示例 (Example for Scala comments)

object MyClass {
def main(args: Array[String]) {
//printing Hello world! - this is single line comment
print("Hello world!");
/* 
This is multiline comment - 
Here, we are printing Hi friends!
*/
print("Hi friends!");
}
}

Output

输出量

Hello world!Hi friends!

翻译自: https://www.includehelp.com/scala/comments-in-scala.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/543746.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

最小生成树prim (c++ 已大改)

2019独角兽企业重金招聘Python工程师标准>>> #include <iostream> #include <vector> #include <set> #include <map> #include <initializer_list> #include <memory> template<typename T> class Graph{private:std::m…

assoc_Ruby assoc()函数

assocRuby中的assoc()函数 (assoc() function in Ruby) We have studied functions to process single dimensional array so far but if we talk about assoc() function, it does not work for single dimensional arrays. assoc() function only works on Array of Arrays o…

前端接入HTTP协议浅析

【摘要】&#xff1a;本文整理并简要分析了HTTP协议的交互过程和内容格式&#xff0c;包括HTTP请求、HTTP应答的头域和实体内容&#xff0c;HTTP 1.0与HTTP 1.1的差异&#xff0c;并举例说明了Chunked编码的工作过程原理。1、HTTP协议简介浏览器和Web服务器之间一问一答的交互过…

互联网传真 传真指令_传真的完整形式是什么?

互联网传真 传真指令传真&#xff1a;传真 (FAX: Facsimile) FAX is an abbreviation of "Facsimile". 传真是“传真”的缩写 。 It is commonly written and spoken as FAX. It is a telephonic transmission of a scanned copy of text and images printed on a p…

C#使用七牛云存储上传下载文件、自定义回调

项目需要将音视频文件上传服务器&#xff0c;考虑并发要求高&#xff0c;通过七牛来实现。 做了一个简易的压力测试&#xff0c;同时上传多个文件&#xff0c;七牛自己应该有队列处理并发请求&#xff0c;我无论同时提交多少个文件&#xff0c;七牛是批量一个个排队处理了。 一…

netfilter que_QUE的完整形式是什么?

netfilter que问题&#xff1a;问题 (QUE: Questions) QUE is an abbreviation of "Questions". QUE是“ Questions”的缩写 。 It is an expression, which is commonly used in the Gmail platform. It is written in the body or the subject of the email to te…

mysqld_multi stop 不能停掉mysql

使用mysqld_multi start 启动了多个mysql&#xff0c;但是mysqld_multi stop 却不能停止原因&#xff1a;因为你还没有授权/usr/local/mysql/bin/mysqld_multi stop 但是默认是停不掉的&#xff0c;需要我们做一个授权grant shutdown on *.* to usernamelocalhost identified…

热冗余冷冗余_冗余支架

热冗余冷冗余Problem statement: 问题陈述&#xff1a; Given a string of balanced expression, find if it contains a redundant parenthesis or not. A set of parentheses is redundant if the same sub-expression is surrounded by unnecessary or multiple brackets. …

对称树

Problem statement: 问题陈述&#xff1a; Given a binary Tree, check whether the tree is symmetric or not. 给定二叉树 &#xff0c; 检查树是否对称 。 Input Example: 输入示例&#xff1a; For example1/ \2 2/ \ / \3 4 4 3The above tree is symmetric1/ \2 …

unity, undo

如果在操作一个Object之前调用Undo.RecordObject(Object)&#xff0c;且操作确实造成Object某些属性的改变&#xff0c;则会产生一个undo记录。 如果我们的架构不是直接操作Object&#xff0c;而是操作一个ui&#xff0c;并在某些时机通过ui.save(Object)将数据回写到Object&am…

ajax应用_AJAX的应用

ajax应用AJAX has several benefits that can be utilized inside a web application. In this article, well explore some advantages of AJAX and see some of its applications. AJAX具有可在Web应用程序内部使用的多个优点。 在本文中&#xff0c;我们将探讨AJAX的一些优势…

Linux下DRBD配置

一、什么是DRBD1、简介 Distributed Replicated Block Device(DRBD)是一个用软件实现的、无共享的、服务器之间镜像块设备内容的存储复制解决方案。数据镜像&#xff1a;实时、透明、同步&#xff08;所有服务器都成功后返回&#xff09;、异步&#xff08;本地服务器成功后返回…

键盘特殊_特殊键盘

键盘特殊Problem statement: 问题陈述&#xff1a; Imagine you have a special keyboard with four types of keys: 想象一下&#xff0c;您有一个特殊的键盘&#xff0c;其中包含四种类型的键&#xff1a; Key 1: Prints I on screen 按键1&#xff1a;在屏幕上打印“ I”…

【C++入门】简单的日期类操作

//--------------------------------------------------------------------------/***名称&#xff1a;日期的简单操作******类函数&#xff1a;构造函数&#xff0c;拷贝构造函数&#xff0c;析构函数&#xff0c;操作符重载函数****日期类操作函数&#xff1a; 1&#xff1a;…

Scala山脉

Scala Range Scala山脉 A Range is a bounded series with a uniform interval with an upper and lower limit. The range literal is a numerical sequence of number ranging with a certain limit. 范围是一个有上限且下限均匀的有界序列。 范围文字是具有一定限制的范围…

黑客经验谈:跳板攻击入侵技术实例解析

网络入侵&#xff0c;安全第一,一个高明的入侵者&#xff0c;不会冒然实行动. 他们在入侵时前会做足功课&#xff0c;入侵时会通过各种技术手段保护自己&#xff0c;以防被对方发现&#xff0c;引火烧身. 其中&#xff0c;跳板技术是攻击者通常采用的技术. 下面笔者结合实例&am…

dom属性和html属性_HTML属性

dom属性和html属性Attributes are used to provide additional information of a tag such as it’s alignments, color, size of the text and other. The attributes are given with the tag that is between the angular brackets after the tag name. The attributes have …

科普:UTF-8 GBK UTF8 GB2312 之间的区别和关系

UTF-8&#xff1a;Unicode TransformationFormat-8bit&#xff0c;允许含BOM&#xff0c;但通常不含BOM。是用以解决国际上字符的一种多字节编码&#xff0c;它对英文使用8位&#xff08;即一个字节&#xff09;&#xff0c;中文使用24为&#xff08;三个字节&#xff09;来编码…

vue3实现本地开发使用的px转换成vw,px转换成rem方法整理

前言&#xff1a; 项目中如果想本地开发使用px&#xff0c;但是界面上线以后界面是自适应的效果,可以有多种方式来实现效果。 一、px转成vw 1、安装&#xff0c;安装成功后&#xff0c;node_modules 会新增这两个插件包 npm i postcss-px-to-viewport-8-plugin 2、新增 post…

airplay2协议是什么_什么是AirPlay?

airplay2协议是什么AirPlay (AirPlay) AirPlay is released by Apple in the year 2004. It allows the easy exchange of audios without the use of any wired technique between the two devices. It was previously termed as AirTunes and later got its name changed to …