TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: STEVE
date: 1997-10-31 01:24:00
subject: multiple assignments (ADVANCED USAGE). 01:24:2510/31/97

From: Steve 
Suppose... I repeat suppose... that SC32 allowed multiple assignments of =
variables such as
n =3D m =3D p =3D 1
I would assume that the variables n,m, and p are all set to 1.
(For those of you who have already found this advanced feature.... =
ignore it for now)
But how would you expect the following to work?
string s[20], t[10], u[4]
s =3D t =3D u =3D "12345678901234"
Would you expect ? (OPTION 1)
u =3D "1234"
t =3D "1234567890"
s =3D "12345678901234"
the longhand version would be:
u =3D "12345678901234"	// which truncates to "1234" since u is only 4 =
characters in size
t =3D "12345678901234"    // which truncates to "1234567890" since t is =
only 10 characters in size
s =3D "12345678901234"   // which does not truncate at all since s is 20 =
characters in size
or would you expect ? (OPTION 2)
u =3D "1234"
t =3D "1234"
s =3D "1234"
whose longhand is
u =3D "12345678901234"    // which truncates to "1234" since u is only 4 =
characters in size
t =3D u                              // which sets t to "1234" since u =
is "1234"
s =3D t                              // which sets s to "1234" since t =
is "1234"=20
Put the string slice issue aside for now... Also, ignore the issue of =
BYTE or WORD types which could possibly be added for additional numeric =
storage... I'll bring that issue up later if need be...
What's your opinion?  Should multiple assignments cause the right-hand =
value to be assigned to each left-handle variable (OPTION 1) or should =
the right-hand expression be assigned to each left-hand variable as it =
passes right to left (OPTION 2)?
Steve
SemWare
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.