Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:44 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM print problem

Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1873
Posted: 08:13am 08 Feb 2012
Copy link to clipboard 
Print this post

Me again pestering all you helpful folk. I have a problem with an extra space being put in a print statement.
In the code:-
a=6:b=10
print a":"b
the result is 6: 10 when it should read 6:10
why does the extra space come in after the colon.
Paul.

"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
djuqa

Guru

Joined: 23/11/2011
Location: Australia
Posts: 447
Posted: 08:26am 08 Feb 2012
Copy link to clipboard 
Print this post

Working exactly as per the language specifications

VK4MU MicroController Units

 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3800
Posted: 08:30am 08 Feb 2012
Copy link to clipboard 
Print this post

Most (all?) Basics are defined to do that. You want a formatted print.

Have a look at things like FORMAT$()

John
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 10:06am 08 Feb 2012
Copy link to clipboard 
Print this post

palcal,

another idea is to print the numbers as strings.

ie

print str$(6);str$(10)

or

a=6:b=10
print str$(a)+":"+str$(b)

Cheers,
Anthony.Edited by ajkw 2012-02-09
 
crackerjack

Senior Member

Joined: 11/07/2011
Location: Australia
Posts: 164
Posted: 10:59am 08 Feb 2012
Copy link to clipboard 
Print this post

...or for not-terribly-realistic solution, try the new PRINT @ syntax, e.g.

[code]
a=6:b=10
cls:print @(100,100) a:print @(115,100) b:pixel(115,103)=1:pixel(115,106)=1
[/code]

...of course it is hardly a real solution, just making a point that there are many ways to achieve an outcome in MMBasic.

Keep havin' fun! (and stick with what ajkw said).Edited by crackerjack 2012-02-09
 
shoebuckle
Senior Member

Joined: 21/01/2012
Location: Australia
Posts: 189
Posted: 10:35pm 11 Feb 2012
Copy link to clipboard 
Print this post

Try
a=6
b=10
Print Format$(a)":"Format$(b)

Prints "6:10" without a leading blank.

Cheers,
Hugh
 
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 08:51pm 12 Feb 2012
Copy link to clipboard 
Print this post

I seem to be having probelms with PRINT @. When I told it to put an X in the middle of the screen (240,216) it put the X significantly to the right of that (the Y coord was OK though.) X=0 makes the X appear about 10 X's (can't remember the exact pixels) out from the left edge. Probably not the right place to put this, but has anyone else had this problem? BTW I'm using MMBasic 3.1
Capacitance is futile - roll on 2012!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024