Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

A Level Computer Science Programming Guide/Variables, Constants and Data Types

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Data types and their usage +PseudocodeData TypeDescriptionUsageExample INTEGERA whole numberUses the normal denary system 123, -123, 0 REALAny number that has fractional parts/decimalsWritten with at least one digit either side of a decimal point 12.4, 3.0, -17.34 CHARA single characterA single character enclosed between single quotation marks 'a', '@', '5' STRINGA series of zero or more charactersNo, or a series of characters enclosed between double quotation marks "banana", "Q173hf", "John Doe" BOOLEANA logical ExpressionTrue or False TRUE, FALSE DATEAny valid dateUse the format: dd/mm/yyyy If a different format must be used, use a comment to explain your decision. 21/10/2015, 03/07/1985, 12/11/1955 Variable Declarations Python has no variable declarations. LanguageGeneral UsageExample UsagePseudocodeDECLARE <Identifier> : <Data Type>DECLARE Weight : INTEGER DECLARE Mass : REAL DECLARE Material : STRINGVB.NETDim <Identifier> As <Data Type>Dim Weight As Integer Dim Mass As Double Dim Material As String Constants Python has no constants. LanguageGeneral UsageExample UsagePseudocodeCONSTANT <Identifier> = <Value>CONSTANT Pi = 3.14 CONSTANT e = "2.718" CONSTANT Multiplier = 10VB.NETConst <Identifier> As <Data Type> = <Value>Const Pi As Double = 3.14 Const e As String = "2.17" Const Multiplier as Integer = 10 Assignments LanguageGeneral UsageExample UsagePseudocode<Identifier> ← <Value>Name ← "Stephen" Age ← 47 Weight ← 19.32VB.NET<Identifier> = <Value>Name = "Stephen" Age = 47 Weight = 19.32Python<Identifier> = <Value>Name = "Stephen" Age = 47 Weight = 19.32