博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Simple statements, blocks, Write, WriteLine and the format string.
阅读量:5245 次
发布时间:2019-06-14

本文共 1690 字,大约阅读时间需要 5 分钟。

static void  SimpleProgram()        // A block is a sequence of zero or more statements enclosed by a matching set of curly braces; it acts as a single syntactic statement.        {            //A statement is a source code instruction describing a type or telling the program to perform an action.            int var1 = 5;            //Write is a menber of the Console class. It sends a text string to the program's console window.            System.Console.Write("This is trival text.");            //WriteLine is another member of Console, which performs the same functions as Write but appends a newline character to the end of each output string.            System.Console.WriteLine("The value of var1 is {0}", var1);             //The first parameter must always be a string and is called the format string.            //The format string can contain substitution markers            //A substitution marker marks the position in the format string where a value should be substituted in the output string.            //It consists of an integer enclosed in a set of matching curly braces. The integer is the numeric position of the substitution value to be used.            //The parameters following the format string are called substitution values. These substitution values are numbered, starting at 0.            System.Console.WriteLine("Two sample integers are {1}, {0} and {1}.", 3, 6);            //A marker must not attempt to referrence a value at a position beyond the length of the list of substition values.             //If it does, it will not produce a compile error but a runtime error (called an exception).        }

 

转载于:https://www.cnblogs.com/limeina/p/3520789.html

你可能感兴趣的文章
几道面试题
查看>>
Factory Design Pattern
查看>>
python中贪婪与非贪婪
查看>>
guava API整理
查看>>
无锁编程笔记
查看>>
jquery mobile
查看>>
如何在vue单页应用中使用百度地图
查看>>
Springboot使用步骤
查看>>
Spring属性注入
查看>>
Springboot-配置文件
查看>>
Springboot-日志框架
查看>>
P1192-台阶问题
查看>>
一、使用pip安装Python包
查看>>
spring与quartz整合
查看>>
Kattis之旅——Eight Queens
查看>>
3.PHP 教程_PHP 语法
查看>>
Duilib扩展《01》— 双击、右键消息扩展
查看>>
利用Fiddler拦截接口请求并篡改数据
查看>>
python习题:unittest参数化-数据从文件或excel中读取
查看>>
在工程中要加入新的错误弹出方法
查看>>