Newbie Question: Line Breaks?

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Post Reply
Munsie
Newbie
Posts: 2
Joined: Wed Dec 28, 2005 8:08 pm
Location: Canada
Contact:

Newbie Question: Line Breaks?

Post by Munsie »

Hey guys, I just started with QuickBASIC..

I'm just wondering how you put a line break in.. Because I'm playing around with INPUT and PRINT.. but I want to space them out (so each line has one Break in between).. Example:

Code: Select all

What is your name?

Your name is NAME? Wow.

How old are you?

You are EIGHTY NINE? Amazing!
That kinda thing..


~Munsie
DrV
Veteran
Posts: 63
Joined: Thu Jun 02, 2005 9:44 pm

Post by DrV »

You can use PRINT without any arguments to jump to the next line:

Code: Select all

PRINT "A"
PRINT
PRINT "B"
Munsie
Newbie
Posts: 2
Joined: Wed Dec 28, 2005 8:08 pm
Location: Canada
Contact:

Post by Munsie »

Ooohk! Thank you so much!

~Munsie
User avatar
Michael Calkins
Veteran
Posts: 76
Joined: Tue Apr 05, 2005 8:40 pm
Location: Floresville, Texas
Contact:

Post by Michael Calkins »

also, just for your info:
chr$(13) is "carriage return"
chr$(10) is "line feed"

In ASCII files, a line break is made by having CHR$(13) followed by CHR$(10). When you are outputing to the screen with PRINT, though, you can use one or the other.
Regards,
Michael
Bring on the Maulotaurs! oops...
I like to slay Disciples of D'Sparil...
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Line Breaks

Post by Zim »

If you're printing to a file, the same concept works:

Code: Select all

Print #1,"A"
Print #1,
Print #1,"B"
...etc...
Just don't forget the comma on the empty Print # statement.
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
Post Reply