下面可以按行解释编码吗? [英] can explain below coding by line?

查看:48
本文介绍了下面可以按行解释编码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否按行解释下面的编码?

can explain below coding by line?

using System;

class MainClass {
  public static void Main() {
    string t;
    int seconds;

    DateTime dt = DateTime.Now;
    seconds = dt.Second;

    // update time if seconds change
    if(seconds != dt.Second) {
      seconds = dt.Second;

      t = dt.ToString("T");
      Console.WriteLine(t);
    }
  }
}

推荐答案

您知道逐行解释代码的工作量吗?您现在应该这样做,因为这是您今天第四次要求这样做,我知道.

每一行都需要一段说明!例如:
Do you have any idea how much work explaining code line by line is? You should do by now, as this is the fourth time today you have asked for it, that I am aware of.

Every single line needs a paragraph of explanation! For example:
int next = r.Next();


创建一个名为"next"的新变量,该变量可以容纳一个整数值.在先前声明的Random实例"r"中,调用"Next"方法以获取新的随机数,并将其分配给"next"变量.

您能想象我们需要花多长时间一行一行地解释一个非常短的代码片段吗?

不,这不会发生.如果您有特定的问题,请提出一个问题.但是首先考虑-您是否想坐下45分钟并在没有充分理由的情况下逐行输入描述?


Create a new variable called "next" which can hold a integer value. From the previously declared Random instance "r", call the "Next" method to get a new random number, and assign it to the "next" variable.

Can you imagine how long it would take us to explain even a very short code fragment like your example, line by line?

No. It is not going to happen. If you have a specific problem, then ask a question about it. But think first - would you want to sit down for 45 minutes and type up a line-by-line description for no good reason?


转到^ ],下载该书并按照自己的方式进行操作,一切都会变得清晰起来.
Go here[^], download the book and work your way through it, and everything will become clear.


所发布的代码段很糟糕(它没有执行应有的功能).
就是说,您很懒惰地要求逐行解释.作为开发人员(想要),您应该深入研究您打算使用的编程语言,并在需要时阅读可用的文档.
The posted code fragment is bad (it doesn''t do what is supposed to).
That said, it is very lazy of you asking for a line-by-line explanation. As a developer (wannabe) you should deeply study the programming language you aim to use and read the available documentation, if needed.


这篇关于下面可以按行解释编码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆