1. to Brent (Lesson 2)
- Posted by Alan Tu <ATU5713 at COMPUSERVE.COM> Sep 25, 1998
- 564 views
>>>>> by the way the variable would be myname=3Dbrent mycountry=3Dnew zealand <<<<< What a great way to start. First, we must know what ASCII is. ASCII is = a fancy acronym for all the characters in the "standard" character set. = Every character has an ascii value. You may know that there are 8 bits i= n a byte, and 2^8 =3D 256. That's why there are 256 ASCII characters, from= 0 to 255. a has value 97, A has value 65 I think. Every character has an ASCII val= ue from 0 to 255. The space bar is 32. Remember how I said Euphoria has two types -- atoms and sequences? Well,= some languages have strings. Strings are lines of characters. To Euphoria, there are zero strings. Strings are sequences of ASCII values. myname =3D abc would be the Euphoria sequence {97,98.99} because those are the corresponding ASCII values. To Euphoria, there is no different between a= string and a sequence. A string is a sequence of ASCII numbers. Here's the catch. If you want to enter: myname=3Dbrent do you want to enter myname =3D {asciiB,asciiR...} I don't think so. So, you have to surround these "strings" with qquotes.= myname =3D "Brent" mycountry =3D "New Zealand" And now you're going to try your first program. --first.ex-- sequence myname,mycountry myname =3D "Brent" mycountry =3D "New Zealand" puts(1,myname) -- 1 is a i/o designator for standard output, which usuall= y -- is the screen puts(1,mycountry) --end What happened? It didn't jump to the next line! The output is smushed together. You need to output a new line character. For homework, look for 2.1 of refman.doc and see if you can find how to output a new-line character. You don't need to output your name and new line using one statement. Just see if you can, using puts, output a new line character. --constants.ex --let's see what constants are --you don't need to tell Euphoria what "type" --a constant is. Just set the value and it will figure it out. constant myname =3D "brent" constant mycountry =3D "New Zealand" puts(1,myname) puts(1,mycountry) --end The point is, you can define constants. The type depends on what you put= in. I wrote a lot, that's it for now. --Alan =
2. Re: to Brent (Lesson 2)
- Posted by Matt Z Nunyabidness <matt1421 at JUNO.COM> Sep 25, 1998
- 593 views
sometimes i accidentally use puts to display sequences. if you do use puts to display sequences, you just get a smiley face. gotta use print or ? ------------------------------------- When it comes to programming languages, Euphoria is a cut above - matt1278 at juno.com and matt1421 at juno.com(and soon to be irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer ___________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]
3. Re: to Brent (Lesson 2)
- Posted by bn <mrsmoo at ES.CO.NZ> Sep 26, 1998
- 526 views
hi alan this is the program i tried but cant get to work have figured out the new line thing with a \n but cant work out the puts to get a new line help please thanx brent