C#变量和常量

1. 变量
using System;

namespace variable {
    class Program {
        static void Main(string[] args) {
             int age = 12;
             bool gender = false;
             float score = 122.3f;
             console.WriteLine("my age", age);
             console.WriteLine("my gender", gender);
             console.WriteLine("my score", score);
          }
    }
}

2. 常量
using System;

namespace constant {
    class Program {
        static void Main(string[] args) {
              const double PI = 3.14;
              console.WriteLine("PI ->", PI);
          }
    }
}

that's all

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,141评论 0 10
  • Lua 5.1 参考手册 by Roberto Ierusalimschy, Luiz Henrique de F...
    苏黎九歌阅读 14,736评论 0 38
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,425评论 0 23
  • 在生活与工作中扮演什么样的角色,决定着关系建立的体验。 家庭与工作都需要性格的差异,家庭中维护...
    杨平的阅读 1,618评论 0 0
  • 一.你我之间 你我之间 是手握坚冰 在炙热的土泥墙上写诗 那些湿漉的文字颤抖着 爬过山丘沟壑 一路艰辛 回首时 却...
    王子水阅读 3,971评论 1 6