Difference between revisions of "Slash"
m (Text replace - "delphi>" to "syntaxhighlight>") |
|||
Line 3: | Line 3: | ||
The '''''/''''' or '''slash''' is used in a [[Pascal]] program to perform division. The results are a real value. If you want integer type value then use the [[Div|div]] operator, [[Round|round]] or [[Trunc|trunc]] function . If you want know remainder use [[Mod|mod]]. | The '''''/''''' or '''slash''' is used in a [[Pascal]] program to perform division. The results are a real value. If you want integer type value then use the [[Div|div]] operator, [[Round|round]] or [[Trunc|trunc]] function . If you want know remainder use [[Mod|mod]]. | ||
− | < | + | <syntaxhighlight> |
A := 3 / 4; | A := 3 / 4; | ||
− | </ | + | </syntaxhighlight> |
returns 0.75 if a is real (if a is integer-type then get error:Incompatible types). | returns 0.75 if a is real (if a is integer-type then get error:Incompatible types). |
Revision as of 14:57, 24 March 2012
The / or slash is used in a Pascal program to perform division. The results are a real value. If you want integer type value then use the div operator, round or trunc function . If you want know remainder use mod.
A := 3 / 4;
returns 0.75 if a is real (if a is integer-type then get error:Incompatible types).
The value on the right side of the slash must not be zero, or a division by zero error occurs. This can be caught through use of a try .. finally or try .. except block.
single characters |
|
character pairs |
|