Skip to Content Java Solaris Communities Partners My Sun Sun Store United States Worldwide

»  Spotlight Articles
»  Projects
»  Publications
»  People
»  Awards
»  Events
»  Downloads
»  Internships
»  Contrarian Minds
»  About Sun Labs

Literals

  • integers 2, -42, 16rFF, 2r101010
  • floats 2.2, -3e6, 3.14159
  • strings 'a', ", '\", '\n', 'Hello sailor!'
  • comments "this is a comment"
  • identifiers: [a-z][a-zA-Z0-9_]*
  • reserved identifiers: self resend

Literals

There are three kinds of simple literals in Self:

  • Integers (non-decimal bases prefixed by the decimal base and r)
  • Floats (all the usual forms)
  • Strings (including embedded C-like escape sequences) enclosed in single quotes:
	'a string'
	'an embedded \' quote'
	''			the empty string
	'lots\tof\nstrange\r\\characters\0'

The comment convention is to surround the comment string with double quotes:

	"this is a comment"

self and resend are the only reserved identifiers.

Identifiers can contain any letter, digit or underscore, and must start with a small letter. Case is significant.

[ Previous ] [ Index ] [ Next ]
Would you recommend this Sun site to a friend or colleague?
Contact About Sun News Employment Privacy Terms of Use Trademarks Copyright 1994-2008 Sun Microsystems, Inc.