Is there something like console.log in Javascript for Visual Basic?
For example, how can I do this with VB?
var monkey = "chimp"; console.log(monkey); //Logs "chimp" in the console.
It depends on the platform and application you are using and more importantly the purpose of the logging.
You can use the Console
class which offers Write
and WriteLine
static methods. This will write your log to standard console. For a console application, this is the best choice:
System.Console.WriteLine("Log text")
If you are using the log just for debugging purposes, you can use the System.Diagnostics.Debug
class with WriteLine
static method. This class also offers a WriteLineIf
method which accepts an argument of type Boolean
and writes the log if the value passed for that argument equals to True
:
System.Diagnostics.Debug.WriteLineIf(x = y, "They are equal")
You can view the debug console output in Visual Studio's output window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With