Comparisment

   - compare programming languages by example

7

Character literals

The syntax for literal characters.

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 :: Char
a = 'a'

A character enclosed in single quotes, NOT double quotes which define a string of characters.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Python

a = 'a'
b = "b"

A character is a string of length 1 and is either enclosed by single or double quotes.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.