Printing on screen.

Just starting out? Need help? Post your questions and find answers here.
hessu
User
User
Posts: 25
Joined: Fri Nov 20, 2015 6:30 am

Printing on screen.

Post by hessu »

In tex Liberty basic I write:

a=5
print"number is ";5
and I get number is 5

How can I do that in Pure basic
the command debug is so confusing
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Printing on screen.

Post by idle »

Code: Select all

a = 5 
Debug "number is " + Str(a) 

OpenConsole() 

PrintN("number is " + Str(a))

Input() 

CloseConsole() 
Windows 11, Manjaro, Raspberry Pi OS
Image
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Printing on screen.

Post by Marc56us »

:idea: Even shorter: no need Str() in some cases 8)

PB does an automatic number transtyping if the line starts with a string
(even if empty string "")

Code: Select all

a = 5
Debug "number is " + a

OpenConsole()

PrintN("number is " + a)

Input()

CloseConsole() 
:wink:
hessu
User
User
Posts: 25
Joined: Fri Nov 20, 2015 6:30 am

Re: Printing on screen.

Post by hessu »

Thank you.

:mrgreen:
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Printing on screen.

Post by Tenaja »

Note that debug should not be used for final programs, only for debugging.
User avatar
mk-soft
Always Here
Always Here
Posts: 6207
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Printing on screen.

Post by mk-soft »

Code: Select all

a = 1
Debug "1+1 is not 2, it's " + a + 1
:mrgreen:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Printing on screen.

Post by skywalk »

Best to always format your numbers and not rely on implied behavior.
Use str(),strD(),roll your own, etc.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply