# how to combine multiple lines into one?

I am trying to figure out a way of combining the below Dim statements into one line and maybe also combining Return dblResult into there. currently it is three lines and I have been told that it is possible but kind of lost of how to do it - can anyone lend a hand please?

` Private Function CalcAreaFromRadius(ByVal radius As Double) As Double

Dim dblRadiusSquared As Double = radius * radius Dim dblResult As Double = dblRadiusSquared * Math.PI Return dblResult End Function`

Thanks

## Answers

Given this is a relatively simple calculation, there's no reason why you can't simplify this down to one line like so:

Private Function CalcAreaFromRadius(ByVal radius As Double) As Double Return radius * radius * Math.PI End Function

While it's not a good idea to put a large number of stuff on one line, you can always use : to put two lines of code in one line in VB:

Canonical example:

Class Test Inherits BaseClass

is equivalent to:

Class Test : Inherits BaseClass

Of course, as long as you are declaring variables on a single type without an explicit initialization expression, you can do that in one Dim statement:

Dim a, b as Integer

Return (radius * radius) * Math.PI