Jump to content
Sal's RuneScape Forum
Sign in to follow this  
Sagara

Questions Regarding Pascal

Recommended Posts

Writeln('Addition: ',N1:2:3,' + ',N2:2:3,' = ',Total:2:3);

N1 and N2 are var

but i don't understand the :2:3 what's it for? any help would be much apreciated

Share this post


Link to post
Share on other sites

I think it adds a few spaces behind the variable so that it is 5 characters long. Does it output something like this?

Addition: 5	 + 65	= 70

Share this post


Link to post
Share on other sites

It's to do with formatting values of type Real and Currency. The first number says that it'll take up 2 character spaces (ones before the decimal point... I think) and the second says it will have 3 decimal places.

 

I've also a feeling that those values are maximum lengths and it'll truncate shorter if there aren't enough digits to fill the spaces, though it's been a few months since last using it and I may be wrong - you'd have to try it out and see what happens.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Guidelines and Privacy Policy.