Editing
Scanco User Instructions
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Basic Arithmetic=== The DCL language supports several types of data in variables. In the "Hello, world" example above, we saw how to store a string in a variable. We could have stored an integer, that is a positive or negative whole number, in the variable, and done some basic math. *Refer to [[Scanco_User_Instructions#Arithmetic_operations|'''Arithmetic Operations''']], For example: <pre> $ i = 1 $ WRITE SYS$OUTPUT i+1 $ j = 3 $ k = j * (i + 1) $ WRITE SYS$OUTPUT k $ WRITE SYS$OUTPUT (k / 4) $ WRITE SYS$OUTPUT 2 + 2 * 2 $ EXIT will return: 2 6 1 6 </pre> Two things are worth noting. *Because we are limited to integers, division of 6 / 4 needs to return an integer (1.5 is not an integer); the value is truncated, which means rounding is always done toward zero. *Order of operations is done in the "correct" order, and not left-to-right, so "2 + 2 * 2" is interpreted as "2 + (2 * 2)".
Summary:
Please note that all contributions to bone.wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BoneWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
associated-pages
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Documents
Recent changes
Help
Tools
What links here
Related changes
Page information