Indy (mighty_gratira) wrote in s2practice,
Indy
mighty_gratira
s2practice

  • Mood:

Print Command Usage

I recently started playing around in S2 (after about a year of having my brain melt every time I tried to look at it...), and I have a programming question. If I knew a bit about Perl or Java, this might be self evident, but previously, I've only worked in PHP. My question concerns whether you should always include a print command and what exactly the "safe" modifier does.

There seem to be two printing commands, print and println. println, I assume, prints the line followed by a line separator. I have noticed, however, that a lot of functions written tend to just dump strings out there, and they are printed. For example, the following would produce the same effect:

print "I like printing!";

"I like printing!";

That doesn't work with variables, just with strings. Also, there is a "safe" modifier, and I have absolutely no idea what that does. Does that prevent the string from being cleaned or does it require the string to be cleaned before printing?

print safe "I like printing!";

So, should a print command always be included? Is just dumping out a string bad programming? Also, how does safe printing differ from normal printing?

Thank you ahead of time. Sorry if this question is a bit basic, but like I said, I have limited experience with programming languages.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment