The underscore allows me to do things like this
Public Sub derp _
(x As Integer)
MsgBox(x)
End Sub
Is there any opposite notation for this? For example, if it was ¯ then I could do
Public Sub derp(x as Integer) ¯ Msgbox(x) ¯ End Sub
You can try using a colon. But you can't put the function/sub body in the same line as the declaration of the function/sub.
Public Sub derp(x As Integer)
MsgBox(x) : MsgBox("Hello, world") : End Sub
You can also try using an action delegate. But it can only have 1 statement if you want to put them in 1 line.
Public herp As Action(Of Integer) = Sub(x) MsgBox(x)
If you want to have multiple line, you write it like this (you can use colons, if you want):
Public herp As Action(Of Integer) = Sub(x)
MsgBox(x)
MsgBox("Hello, world")
End Sub
Use Func delegate if you want to return a value instead of Action delegate.
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