Reputation: 182
PHP :
if(($a = $toto) == 'test') echo $a;
VB.net
Dim a as string = toto
if a.equals("test") then console.writeline(a)
I like the "one line" code design, so, is it possible to do that in vb.net ?
Upvotes: 1
Views: 199
Reputation: 566
You Can use the following......
I haven't done it but I hope it will help u ..
Option Explicit Off
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ((ss = "test") = "test") Then MessageBox.Show("hi")
End Sub
End Class
Upvotes: 0
Reputation: 9322
It would be multi-liners instead like this instead
Dim a As String = "test"
Dim b As String = a
if (b.equals("test")) then console.writeline(b)
Or as Alexander suggested you could use one liner like this (which actually not really one liner in the compiler most likely)
Dim a As String = "test", b As String = a
if (b.equals("test")) then console.writeline(b)
Upvotes: 2