编程语言注释示例

1. Golang

文件头
 

// Package main
// desc: this is the main file
// author: Your Name
// date: 2024/1/11
// version: 1.0.0

2. C/C++
文件头
 

//////////////////////////////////////////////////
//
// this is description
//
// author: Your Name
// date: 2024/1/11
// version: 1.0.0
//
//////////////////////////////////////////////////
/****************************************
 *
 * this is description
 *
 * author: Locker
 * date: 2024/1/11
 * version: 1.0.0
 *
 ****************************************/

函数注释

/**************************************************
 * function name                                             
 *    Desc: this is function description.   
 *    Returns: return something.   
 *    Parameters:                                             
 *       name: this is a param-desc
 *       age: this is a param-desc                    
 **************************************************/
int findOne(char name, int age) {
    return 1;
}

3. Java

类注释

/**
 * this is description
 *
 * @author Your Name
 * @date 2024/1/11
 * @version 1.0.0
 * @see cn.hutool.core.map.MapUtil
 * @see com.google.common.collect.Maps
 */

方法注释

/**
 * function description
 * <p>
 * something else
 * <p>
 * {@link AbcClass#methodB()}
 *
 * @param name .
 * @param age .
 * @return sth.
 * @see com.project.common.Result
 */
Result findOne(String name, int age);

4. C#

模块与类

///<summary>
///
/// this is description
///
/// author: Your Name
/// data: 2024/1/11
/// version: 1.0.0
///
///</summary>

5. PHP

文件头

// +-------------------------------------------------------------------+
// | This is a PHP file.                                               |
// | =============================                                     |
// |                                                                   |
// | PHP is the beast.                                                 |
// +-------------------------------------------------------------------+
// | PHP version 5 required.                                           |
// +-------------------------------------------------------------------+
// | Homepage:     http://www.your.org/                                |
// +-------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or     |
// | modify it under the terms of the GNU General Public License as    |
// | published by the Free Software Foundation; either version 2 of    |
// | the License, or (at your option) any later version.               |
// |                                                                   |
// | This program is distributed in the hope that it will be useful,   |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of    |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     |
// | GNU General Public License for more details.                      |
// |                                                                   |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, contact:                         |
// |                                                                   |
// | author:  Your Name        										   |
// | date:    2024/1/11        										   |
// | version: 1.0.0                    								   |
// |                                                                   |
// +-------------------------------------------------------------------+

6. Shell

文件头

# =========================================================================== #
#           FILE:  start.sh                                                   #
#          USAGE:  sudo ./start.sh                                            #
#                                                                             #
#    DESCRIPTION:  This script helps to pass through the captive portals in   #
#                  public Wi-Fi networks. 				                      #
#                                                                             #
#   REQUIREMENTS:  coreutils, sipcalc, nmap                                   #
#         AUTHOR:  Your Name										          #
#        COMPANY:  Hire me! I am a cool dude!                                 #
#        VERSION:  1.0.0                                                      #
#        CREATED:  2024.1.11 - 11:11                                          #
#      COPYRIGHT:  2016 Stanislav "systematicat" Kotivetc                     #
#        LICENSE:  WTFPL v2                                                   #
# =========================================================================== #

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

差点GDP

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值