Difference between revisions of "Talk:Hello World Tutorial"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "Should we add a note about comments somewhere on this page? It's the first in the series on the tutorials page, so it would make the most sense here. Certainly not worth a new...")
 
(talk)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
Should we add a note about comments somewhere on this page? It's the first in the series on the tutorials page, so it would make the most sense here. Certainly not worth a new page to itself. [[User:My hat stinks|my_hat_stinks]] 17:21, 19 May 2012 (UTC)
 
Should we add a note about comments somewhere on this page? It's the first in the series on the tutorials page, so it would make the most sense here. Certainly not worth a new page to itself. [[User:My hat stinks|my_hat_stinks]] 17:21, 19 May 2012 (UTC)
 +
: I actually came here specifically to ask that question. I Have just started going through the tutorials and got to the page [[Conditional statements]] where comments are used without any introduction. This is the most logical place. I suggest a small bit of reordering putting the '''print''' command first and introducing comments there. Perhaps
 +
 +
To simply print it, type:
 +
--Simple Print
 +
print("Hello World!")
 +
 +
To print it letter by letter, type:
 +
--Slow Print
 +
textutils.slowPrint("Hello World!")
 +
Please don't overuse slowprint. If you share your code it can annoy some users.
 +
 +
You can also use:
 +
write("Hello World!\n")
 +
'''\n''' is known as the newline character and makes any following output start on the next line. (print does this automatically!)
 +
 +
: And then put a comment ''The lines beginning with '''--''' are not necessary for the program to function but are comments. When a program runs it will completely skip these lines. However, it is recommended that you get into the habit of commenting your code for readability and to help you or others understand the code if you return to it after some time.''
 +
: I also made some other minor adjustments to the text above, hopefully improving readability and accuracy. [[User:Wackozacko|Wackozacko]] 16:18, 3 September 2012 (EDT)
 +
 +
 +
 +
no such program, no such program, no such program. [[Special:Contributions/101.169.42.145|101.169.42.145]] 23:48, 10 November 2012 (MSK)

Latest revision as of 19:48, 10 November 2012

Should we add a note about comments somewhere on this page? It's the first in the series on the tutorials page, so it would make the most sense here. Certainly not worth a new page to itself. my_hat_stinks 17:21, 19 May 2012 (UTC)

I actually came here specifically to ask that question. I Have just started going through the tutorials and got to the page Conditional statements where comments are used without any introduction. This is the most logical place. I suggest a small bit of reordering putting the print command first and introducing comments there. Perhaps

To simply print it, type:

--Simple Print
print("Hello World!")

To print it letter by letter, type:

--Slow Print
textutils.slowPrint("Hello World!")

Please don't overuse slowprint. If you share your code it can annoy some users.

You can also use:

write("Hello World!\n")

\n is known as the newline character and makes any following output start on the next line. (print does this automatically!)

And then put a comment The lines beginning with -- are not necessary for the program to function but are comments. When a program runs it will completely skip these lines. However, it is recommended that you get into the habit of commenting your code for readability and to help you or others understand the code if you return to it after some time.
I also made some other minor adjustments to the text above, hopefully improving readability and accuracy. Wackozacko 16:18, 3 September 2012 (EDT)


no such program, no such program, no such program. 101.169.42.145 23:48, 10 November 2012 (MSK)