Comparisment

   - compare programming languages by example

1

Single line comment

The syntax for a single human readable line of text written inline with source code.

Created by sam

Add a new answer

Either add an answer for a new language or add an alternative solution.
A description is only necessary when the code is not suitably 'obvious' or to justify an alternative approach.

Haskell

-- A single line comment

Two dashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Python

# A single line comment

A hash/ number sign/ pound sign starts a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

C

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

C++

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

C#

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Clojure

; A single line comment

A semicolon starts a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

F#

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Go

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Java

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

JavaScript

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Objective-C

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Perl

# A single line comment

A hash/ number sign/ pound sign starts a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

PHP

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Ruby

# A single line comment

A hash/ number sign/ pound sign starts a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Rust

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Scala

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Swift

// A single line comment

Two forward slashes start a line comment.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.