{}
和 //
都用于根据大小添加注释吗?
很抱歉问了这个愚蠢的问题,但是当我尝试用 google 搜索“{}//Delphi”时,我会得到 Delphi.com 和 Wikipidia 的链接以获取随机信息。
最佳答案
可以通过三种方式向 delphi 源文件添加注释:
{ This can be a single line comment }
{ but it can also span multiple lines
}
// Single line comment
单行注释在行尾结束。其他评论都有自己的结局。
(* This also can be a single comment *)
(* And it also can span multiple lines
*)
{ Can be used to comment out code containing a (* comment *)
// Or one of those
}
(* Can be used to coment out code containing a { comment }
// Or one of those
*)
// And this can contain the (* Single *) version of the { other } comments.
没有什么真正的区别。但有些人保留一种注释风格来(临时)注释掉代码。因为你不能嵌套相同的类型,但可以嵌套不同的类型。
琐事,包含 (* *) 注释是为了支持没有 { 和 } 的(真正的)旧键盘。您还可以使用 (. .) 表示 []。
关于delphi - {}和//的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21856605/