在函数外部使用形如:name:="mark"这样语句会出现 syntax error: non-declaration statement outside function body

package main

import "fmt"

var age uint8  // ok
var age1 uint8 = 18 // ok
var age2 = 18 // ok
age3 := 18 // error
// 出错的原因在于 age3 := 18实际上是两条语句 var age3 int + age3 = 18
// 然而age3 = 18这样的语句是不能再函数体之外执行的
// 就行下面两行代码
ag1 = 29 // error
age2 = 21 // error func main() {
fmt.Println("...")
}

syntax error: non-declaration statement outside function body的更多相关文章

  1. Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in

    学习php的命名空间,直接把手册的代码粘贴过来,却报错了:Fatal error: Namespace declaration statement has to be the very first s ...

  2. [ThinkPHP]报错:Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in E:\wamp\www\jdlh\application\index\controller\Index.php on line

    错误提示说命名空间声明语句必须是第一句,可我看就是第一句没毛病呀,这是为啥呢,后面发现<?php 前面有个空格,删掉就正常了 去掉空格之后页面能正常显示

  3. JS function document.onclick(){}报错Syntax error on token "function", delete this token

    JS function document.onclick(){}报错Syntax error on token "function", delete this token func ...

  4. JSP报错Syntax error, insert ";" to complete Statement

    org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 7 in ...

  5. error: expected declaration or statement at end of input----solved

    error: expected declaration or statement at end of input 解决方法: 1.程序缺少一个括号相应地 2.而不添加头文件 版权声明:本文博主原创文章 ...

  6. JS function document.onclick(){}报错Syntax error on token "function", delete this token - CSDN博客

    原文:JS function document.onclick(){}报错Syntax error on token "function", delete this token - ...

  7. Linux下docker报错syntax error:unexpected protocol at end of statement

    ---恢复内容开始--- [Linux]Shell脚本“syntax error: unexpected end of file”原因及处理 :::https://blog.csdn.net/u013 ...

  8. HiveServer2 的jdbc方式创建udf的修改(add jar 最好不要使用),否则会造成异常: java.sql.SQLException: Error while processing statement: null

    自从Hive0.13.0开始,使用HiveServer2 的jdbc方式创建udf的临时函数的方法由: ADD JAR ${HiveUDFJarPath} create TEMPORARY funct ...

  9. php出现“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误的一种情况,及解决方法

    PHP中的“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误,可能是因为美元符号$的误用,看下面一种情况 class Test{         s ...

随机推荐

  1. Oracle同义词和序列

    同义词:是表.索引.视图的模式对象的一个别名,通过模式对象创建同意词,可以隐藏对象的实际名称和 所有者信息,为对象提供一定的安全性,开发应用程序时:应该尽量避免直接使用表,视图 或其他对象,改用对象的 ...

  2. Oracle和MySQL在使用上的区别

    1.  Oracle是大型数据库而MySQL是中小型数据库,MySQL是开源的而Oracle的价格非常高. 2.  Oracle支持大并发,大访问量. 3.  安装所用的空间差别也是很大,MySQL安 ...

  3. testng系列-ReportNG

    生成reportng报告操作步骤: 一.maven的pom.xml文件需要添加内容: <properties> <!-- maven 参数配置,这里引用不同的testng.xml - ...

  4. Wampserver 修改根目录

    wampserver 默认根目录在 www 文件夹下 修改根目录方法如下: 1. 在打算存放项目或代码的位置新建文件夹(我建在了C:/MyProject) 2. 打开 httpd.conf 文件(该文 ...

  5. 兰亭集势收购美国社交购物网站Ador,收购的是人才

    1 月 6 日消息,外贸电商公司兰亭集势(LightInTheBox)今日宣布,已经完成对美国社交电商网站 Ador 公司的收购.Ador 公司总部位于西雅图.这项资产收购通过现金完成,但未披露交易金 ...

  6. JSON.stringify处理对象时的问题

    1. JSON.stringify({entry_key: 'test', entry_detail: undefined}) 结果 为 "{"entry_key": & ...

  7. js 插件 issue

    1 iscroll 5 和 lazyload 同时使用  转自 yinjie //lazyload var $scrollEle = $("#wrapper") $("i ...

  8. 王者荣耀交流协会 -- 第4次Scrum会议

    Scrum master : 王磊 要求1 : 工作照片 照片由高远博同学拍摄 ,王露芝同学(外援)没有参加本次会议. 要求2 : 时间跨度:2017年10月16日 18:00 - 18:44 共计4 ...

  9. 团队项目选题报告(I know)

    一.团队成员及分工 团队名称:I know 团队成员: 陈家权:选题报告word撰写 赖晓连:ppt制作,原型设计 雷晶:ppt制作,原型设计 林巧娜:原型设计,博客随笔撰写 庄加鑫:选题报告word ...

  10. Android自定义XML属性以及遇到的命名空间的问题

    转载请注明出处:http://www.cnblogs.com/kross/p/3458068.html 最近在做一些UI,很蠢很蠢的重复写了很多代码,比如一个自定义的UI Tab,由一个ImageVi ...