|
|
IT SOLUTIONS
Your TECHNOLOGY partner!
|
|
|
|
Languages FocusCommenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpreter.
Intermediate1 Intermediate Level Question More Info
|
Delphi Prism: // or { ... } or (* ... *)Commenting Code Compiler Directives - $
Compiler DirectivesIn the $IFDEF example above, the TEMPOUT identifier is not defined, the $IFDEF evaluates to false and skips the code during compile. The code is never compiled. Custom Compiler DirectivesIn addition to using the many built-in compiler directives, you can define your own. Here is a simple example. {$Define MYDEBUGMODE}{$IfDef MYDEBUGMODE} MessageBox.Show("In debug mode.");{$Else} MessageBox.Show("Out of debug mode.");{$EndIf}{$UnDef MYDEBUGMODE}{$IfDef MYDEBUGMODE} MessageBox.Show("In debug mode.");{$Else} MessageBox.Show("Out of debug mode.");{$EndIf}
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Delphi Prism Comments (// or { ... } or (* ... *)) |
Commenting Code
Java uses "//" for a single line comment and /* */ for a multiple line comment.
Syntax Example:
//Single line comment in MS (not ANSI compliant so do NOT use). */ /* * This is another popular way * to write multi-line comments. */ More Info |
Commenting Code
JavaScript uses "//" for a single line comment and /* */ for a multiple line comment.
Syntax Example:
//This is a single line comment. */ More Info |
Commenting Code
ObjectPAL uses ; for a single line comment and { } for a multiple line comment.
Syntax Example:
;Single line comment. Multiple line comment. }
|
Commenting Code
Perl uses # for single line comments and Perl does NOT have a multiple line comment.
Compiler Directives (A special comment.)
Perl also uses compiler directives embedded in comments with #! as in:
#!/usr/local/bin/perl -w
Syntax Example:
#This is a comment in Perl. More Info |
Commenting Code
Use the multi-line to comment out large blocks of code and to write multiple line comments.
Syntax Example:
#This is a comment in PHP. //This is too! /* This is a multi-line comment. */ More Info |
Commenting Code
VB Classic, like all the VB-based languages, uses a single quote (') or the original class-style basic "REM" (most developers just use a quote). VB Classic does NOT have a multiple line comment.
Directives - #
Directives are sometimes called compiler or preprocessor directives. A # is used for directives within VB Classic code. VB Classic offers only an #If..then/#ElseIf/#Else directive.
Syntax Example:'Single line comment. REM Old school single line comment. |
You can simulate a multi-line comment with code which is useful especially if you wish to comment out a block of code.
For example:
If False Then
'...code here skipped.
End If
Here is a simple example of using VB Classic's directive (change True to False to switch it).
#Const MyDirective = True
#If MyDirective Then
MsgBox ("Yes")
#Else
MsgBox ("No")
#End If
| VB Classic Comments (' or REM) |
Commenting Code
VB.Net, like all the VB-based languages, uses a single quote (') or the original class-style basic "REM" (most developers just use a quote). VB.Net does NOT have a multiple line comment.
Syntax Example:'Single line comment. REM Old school single line comment. |
You can simulate a multi-line comment with code which is useful especially if you wish to comment out a block of code.
For example:
If False Then
'...code here skipped.
End If
The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.
2 Beginner Level Questions
| VB.Net Comments (' or REM) |
| Go ahead! Use Us! | Call: 916-726-5675 |
|
ACCOUNT OVERVIEW:
|
WHY US:
|
ABOUT US:
|
SELF HELP:
Web Address: [WhoIs]
|
CONTACT US:
Office Hours: 8am-5pm | Mon thru Fri
916-726-5675 (office)
916-726-5676 (fax)
916-726-5676 (24hr text)
8421 Auburn Blvd, STE 256
Citrus Heights, CA 95610
|
|
||||||||||||
|
|