Debug with more than one parameter

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Hysteria
User
User
Posts: 50
Joined: Sat Oct 23, 2010 8:51 am
Location: UK

Debug with more than one parameter

Post by Hysteria »

Apologies if this has already been requested, I did have a quick look first :wink:

It would be very useful to be able to use the command debug with more than one parameter. Many times I've wanted to use: debug "Variable name", variable

Many thanks.

update I've realised this can be achieved by debug "text"+variable. oops :oops:

Not sure if there is any merit in allowing comma seperators, e.g. debug A$,b,"xyz". Probably not.
User avatar
STARGÅTE
Addict
Addict
Posts: 2226
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Debug with more than one parameter

Post by STARGÅTE »

Note: The second parameter specifies the debug level!
Syntax
Debug <expression> [, DebugLevel]

Code: Select all

DebugLevel 1
Debug "Level Default"
Debug "Level 1", 1
Debug "Level 2", 2
Debug "Level 3", 3
Debug "Level 1", 1
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Debug with more than one parameter

Post by Tenaja »

Hysteria wrote:Apologies if this has already been requested, I did have a quick look first :wink:

It would be very useful to be able to use the command debug with more than one parameter. Many times I've wanted to use: debug "Variable name", variable

Many thanks.

update I've realised this can be achieved by debug "text"+variable. oops :oops:

Not sure if there is any merit in allowing comma seperators, e.g. debug A$,b,"xyz". Probably not.
debug "a="+str(a)+", b="+str(b)

...and yes, it's a pita typing str so many times.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Debug with more than one parameter

Post by PB »

You can use the watch list for viewing variable values in realtime, or even hover the mouse over a variable name in the ide to see its value.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
C64
Enthusiast
Enthusiast
Posts: 151
Joined: Sat Dec 18, 2010 4:40 am

Re: Debug with more than one parameter

Post by C64 »

Here's a way to print three variables at a time, but not on the same line. It's handy so you don't have to type Str() all the time.

Code: Select all

Macro Debug3(v1,v2,v3)
  Debug v1
  Debug v2
  Debug v3
EndMacro

three$="3"

Debug3(1,"two",three$)
Post Reply