using System.Collections; using System.Collections.Generic; using UnityEngine; public class Main : MonoBehaviour{ private bool boolVal; private byte byteVal; private double doubleVal; private float floatVal; private int intVal; private long longVal;
1.布尔型(boolean)变量默认值为false,byte.short.int.long为0,字符型为'\u0000'(空字符),浮点型(float double)为0.0,引用类型(String)为null. package cn.nxl2018; public class Test { private boolean bool; private byte bt; private short st; private char ch; private int i; private long l
代码 // 基本数据类型(整型,浮点型,字符串型,布尔型)的默认值 package main import ( "fmt" ) func main() { var a int var b float32 var c bool var d string fmt.Printf("整型a的值为%v, 浮点型b的值为%v, 布尔型c的值为%v, 字符串型d的值为%v\n", a, b, c, d) // 整型a的值为0, 浮点型b的值为0, 布尔型c的值为false, 字符
默认值: 整型的默认值:0 浮点型的默认值:0字符串的默认值:"" //空布尔类型的默认值:false package mainimport "fmt" func main() { var a int //0 var b float32 //%f的输出是0.000000,%v的输出是0 var c float64 //%f的输出是0.000000,%v的输出是0 var isMarryied bool //false var name string //&quo