It is currently Thu Mar 28, 2024 7:34 am


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Unit 2 - Lesson 5: Expressions – Data Types: Strings
PostPosted: Thu Jun 02, 2011 10:17 am 
User avatar

Joined: Wed Nov 17, 2010 8:37 am
Posts: 136
Real Name: Terry L. Wiechmann
Began Programming in MUMPS: 0- 0-1971
This lesson covers the concept of a string in detail and there is not much to add. Because there is only one data type, the string, understanding how the system converts a string to a number is very important. The conversion is context dependent.

First, the command context determines the evaluation. The command argument contains an expression that must evaluate to one of the levels depicted in the diagram at the beginning of the lesson. For example, the argument of an IF command is an expression that must evaluate to a truth value.

Second, the expression itself can determine the context. This is amply illustrated by the examples in the lesson. For example:

> WRITE “22 aardvarks”
produces
22 aardvarks
however,
WRITE +”22 aardvarks”
produces
22

The process is quite simple, if the context of the expression dictates a numeric evaluation, the string is scanned for numerics left to right until a non-numeric is encountered.

Exercise

Do the exercise at the end of the lesson. If you do not understand the results you are getting, please ask questions.
Play with some values in direct mode.


When we get to Operators, we will visit this concept again especially when dealing with arithmetic operations.

_________________
Terry L. Wiechmann


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net