Question:
how would you describe each of these in pascal? String,Integer,Real,Boolean,Character?
2008-06-25 15:59:14 UTC
the internet difinitions use complicated proggarming vocab, if you could explain each one in the most simplest of forms.

thanks
Three answers:
Neil D
2008-06-25 16:09:21 UTC
Well a string is characters...can be letters or numbers or a miture of the two.



Intetger is a number ONLY



Real...Ive never even heard of that!



Char is a character.........
MacMan2511
2008-06-25 16:21:12 UTC
String = Bunch (2+) Of Characters

Integer = Number

Real = ?

Boolean = 1,0 (On Or Off)

Char = One character
Kaushalya Damitha
2008-06-25 21:10:15 UTC
this is found on the Delphi Help

Delphi is Advance version of pascal.if u are interested in pascal learn Delphi it is same as pascal but more Useful



Integer

An integer type represents a subset of the whole numbers. The generic integer types are Integer and Cardinal; use these whenever possible, since they result in the best performance for the underlying CPU and operating system. The table below gives their ranges and storage formats for the Delphi compiler.



Generic integer types



Type Range Format

Shortint -128..127 signed 8-bit

Smallint -32768..32767 signed 16-bit

Longint -2147483648..2147483647 signed 32-bit

Int64 -2^63..2^63-1 signed 64-bit

Byte 0..255 unsigned 8-bit

Word 0..65535 unsigned 16-bit

Longword 0..4294967295 unsigned 32-bit

UInt64 0..2^64–1 unsigned 64-bit



Char

The fundamental character types are AnsiChar and WideChar. AnsiChar values are byte-sized (8-bit) characters ordered according to the locale character set which is possibly multibyte. AnsiChar was originally modeled after the ANSI character set (thus its name) but has now been broadened to refer to the current locale character set.



WideChar characters use more than one byte to represent every character. In the current implementations, WideChar is word-sized (16-bit) characters ordered according to the Unicode character set (note that it could be longer in future implementations). The first 256 Unicode characters correspond to the ANSI characters.



The generic character type is Char, which is equivalent to AnsiChar on Win32, and to Char on the .NET platform. Because the implementation of Char is subject to change, it's a good idea to use the standard function SizeOf rather than a hard-coded constant when writing programs that may need to handle characters of different sizes.



Note: The WideChar type also maps to Char on the .NET platform.



A string constant of length 1, such as 'A', can denote a character value. The predefined function Chr returns the character value for any integer in the range of AnsiChar or WideChar; for example, Chr(65) returns the letter A.



Character values, like integers, wrap around when decremented or incremented past the beginning or end of their range (unless range-checking is enabled). For example, after execution of the code



var

Letter: Char;

I: Integer;

begin

Letter := High(Letter);

for I := 1 to 66 do

Inc(Letter);

end;

Letter has the value A (ASCII 65).



Boolean Types

The four predefined Boolean types are Boolean, ByteBool, WordBool, and LongBool. Boolean is the preferred type. The others exist to provide compatibility with other languages and operating system libraries.



A Boolean variable occupies one byte of memory, a ByteBool variable also occupies one byte, a WordBool variable occupies two bytes (one word), and a LongBool variable occupies four bytes (two words).



Boolean values are denoted by the predefined constants True and False. The following relationships hold.



Boolean ByteBool, WordBool, LongBool

False < True False <> True

Ord(False) = 0 Ord(False) = 0

Ord(True) = 1 Ord(True) <> 0

Succ(False) = True Succ(False) = True

Pred(True) = False Pred(False) = True



A value of type ByteBool, LongBool, or WordBool is considered True when its ordinality is nonzero. If such a value appears in a context where a Boolean is expected, the compiler automatically converts any value of nonzero ordinality to True.



Real Types

A real type defines a set of numbers that can be represented with floating-point notation. The table below gives the ranges and storage formats for the fundamental real types on the Win32 platform.



Fundamental Win32 real types



Type Range Significant digits Size in bytes

Real48 -2.9 x 10^39 .. 1.7 x 10^38 11-12 6

Single -1.5 x 10^45 .. 3.4 x 10^38 7-8 4

Double -5.0 x 10^324 .. 1.7 x 10^308 15-16 8

Extended -3.6 x 10^4951 .. 1.1 x 10^4932 10-20 10

Comp -2^63+1 .. 2^63 1 10-20 8

Currency -922337203685477.5808.. 922337203685477.5807 10-20 8



The following table shows how the fundamental real types map to .NET framework types.



Fundamental .NET real type mappings



Type .NET Mapping

Real48 Deprecated

Single Single

Double Double

Extended Double

Comp Deprecated

Currency Re-implemented as a value type using the Decimal type from the .NET Framework



The generic type Real, in its current implementation, is equivalent to Double (which maps to Double on .NET).



Generic real types



Type Range Significant digits Size in bytes

Real -5.0 x 10^324 .. 1.7 x 10^308 15–16 8



Note: The six-byte Real48 type was called Real in earlier versions of Object Pascal. If you are recompiling code that uses the older, six-byte Real type in Delphi, you may want to change it to Real48. You can also use the {$REALCOMPATIBILITY ON} compiler directive to turn Real back into the six-byte type.



The following remarks apply to fundamental real types.



Real48 is maintained for backward compatibility. Since its storage format is not native to the Intel processor architecture, it results in slower performance than other floating-point types. The Real48 type has been deprecated on the .NET platform.

Extended offers greater precision than other real types but is less portable. Be careful using Extended if you are creating data files to share across platforms.

The Comp (computational) type is native to the Intel processor architecture and represents a 64-bit integer. It is classified as a real, however, because it does not behave like an ordinal type. (For example, you cannot increment or decrement a Comp value.) Comp is maintained for backward compatibility only. Use the Int64 type for better performance.

Currency is a fixed-point data type that minimizes rounding errors in monetary calculations. On the Win32 platform, it is stored as a scaled 64-bit integer with the four least significant digits implicitly representing decimal places. When mixed with other real types in assignments and expressions, Currency values are automatically divided or multiplied by 10000.



Strings are Set of Char

Ex 'Damitha' is a String all he letters are char


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...