A newbie question: "1;"

They have: 60 posts

Joined: Aug 2000

I saw some scripts use 1; at the end, and what is that?

They have: 568 posts

Joined: Nov 1999

1;? I think thats just another way of saying exit. But who knows, some people are weird. Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

And NOTHING can go after it. AT ALL.

1; is vital as the last line of any required file. It tells the master file that the required file EXISTS.

Smiling Suzanne

They have: 60 posts

Joined: Aug 2000

I do have required files without 1;
And they work fine, the main script still include the file when compiling

They have: 314 posts

Joined: Nov 1999

I too have required files in scripts before and never added 1 to the end but I saw it in one of the ubb files and always wondered what it meant.

They have: 568 posts

Joined: Nov 1999

I just figured out the REAL meaning of it. Smiling

It seems that when you are using sub routines in a seperate file from the script you have to put the 1; at the end so it will work correctly.

They have: 429 posts

Joined: Jul 2000

I know I always put 'Mom' in the end of my scripts.

Umm.. Turn that camera off!

They have: 60 posts

Joined: Aug 2000

What if I don't? Will the sub work okay? I tried & they seem fine!

They have: 117 posts

Joined: Mar 2000

I think it has something to do with the required file must return a positive output or something. My server used to tell me something like that when I didn't put it at the end.

--Edge

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I told ya, geez!

Yes, it is especially important for sub-routines, so the master file knows where it ends.

However good programming habits prevent frustrations and screw ups.

If you have an included file, subroutine or not, add the 1; to save yourself a potential headache.

*aside -- who let in all these free thinkers? man!*

Laughing out loud Suzanne

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.