Difference between revisions of "Comment"

esse quam videri
Jump to: navigation, search
(Created page with "=Definition= =Relevance= =Explanation= Class Diagram =Resources= == See also == ==Notes== ==External Links== Category:Programming Language Concepts Category:...")
 
Line 1: Line 1:
 
=Definition=
 
=Definition=
 +
A programmer-readable explanation or note in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters.
  
 
=Relevance=
 
=Relevance=
 +
Think of coding as a way of communicating with the computer. Comments are the same idea, only it’s humans trying to understand what it is your code is saying!
  
 
=Explanation=
 
=Explanation=
 +
Basically just writing side notes when reading or working
 +
Comments can be used for multiple purposes: pseudocode to layout the logic of the code in simpler terms, describing in a sentence or phrase what the code is meant to do, or even just to relieve some stress for other programmers when they read through!
 +
 +
=Example=
 +
<syntaxhighlight lang ="csharp">
 +
/* this is a comment in C. You can write notes here!
 +
This comment syntax is guaranteed to
 +
work on every compiler */
 +
 
 +
// This is also a comment in C - yay!
 +
// (but it might present portability challenges)
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang ="html">
 +
<!-- This is a comment in HTML -->
 +
</syntaxhighlight>
  
 
Class Diagram
 
Class Diagram

Revision as of 18:38, 20 June 2019

Definition

A programmer-readable explanation or note in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters.

Relevance

Think of coding as a way of communicating with the computer. Comments are the same idea, only it’s humans trying to understand what it is your code is saying!

Explanation

Basically just writing side notes when reading or working Comments can be used for multiple purposes: pseudocode to layout the logic of the code in simpler terms, describing in a sentence or phrase what the code is meant to do, or even just to relieve some stress for other programmers when they read through!

Example

/* this is a comment in C. You can write notes here! 
This comment syntax is guaranteed to
work on every compiler */
  
// This is also a comment in C - yay!
// (but it might present portability challenges)
<!-- This is a comment in HTML -->

Class Diagram

Resources

See also

Notes

External Links