Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

String definition/declarations


4 replies to this topic

gronchi

gronchi
  • Members
  • 71 posts

Posted 11 May 2005 - 16:24

Hi to all,
it seems to me very strange but compiling following IS code:
CODE

...
string 3Gparameter;
...
3Gparameter = "";
...


will produce a compiling error:
functionX.rul(183): error C8008: '3' : identifier expected
functionX.rul(196): error C8079: '3' : invalid statement

Why?
Didn't a string start with a number?

Thanks to all, ciao
Giuseppe


Xitch13

Xitch13
  • Members
  • 134 posts

Posted 11 May 2005 - 19:31

I have come across that as well Gronchi. I solved it by renaming the variable with a name that does not start with a numeral. I did try and find the rules for naming variables under IS Pro, but couldn't find it in 10 mintes of looking.
There is great chaos under heaven, and the situation is excellent. (Mao Tse Tung)

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 12 May 2005 - 01:22

Such a syntax restriction is pretty standard, and as Xitch13 stated, it's easy enough to workaround.
user posted image

Ozone

Ozone
  • Full Members
  • 77 posts

Posted 18 May 2005 - 16:29

Check this out from the Language Reference Guide. Page 6

Identifiers

Identifiers are the names that you create to denote constants, variables, and functions in your script.
Observe the folowing syntax rules when creating identifiers.

1. An identifier may be of any length, but only the first 63 characters are significant.

2. The first character of an identifier must be alphabetic (a-z,A-Z) or an underscore (_).

3. The remaining characters may be alphabetic (a-z,A-Z), numeric (0-9), or an underscore (_).

4. Each identifier must be unique. Be careful not to create an identifier that is a reserved work in InstallScript.

Perotin

Perotin
  • Full Members
  • 407 posts

Posted 20 May 2005 - 11:11

in addition to the quoted rules, it may be helpful to start an identifier with a character that tells about the type, like s... for string an n... for numeric variables.
You may even use sv... for variable strings and sz... for literals and so on.
Gruß / regards
Thomas