Passing variables.

Passing variables.

SRSDS
Advisor Advisor
855 Views
4 Replies
Message 1 of 5

Passing variables.

SRSDS
Advisor
Advisor

Can someone suggest what is wrong here?

Diameter is passed in as 12.7 but it is not acceptint it as a true statement.

 

    Function Volume(Diameter As Single)
        If Diameter = 12.7 Then
        end if
    End Function

 

0 Likes
Accepted solutions (1)
856 Views
4 Replies
Replies (4)
Message 2 of 5

arcticad
Advisor
Advisor
Accepted solution

    Function Volume(ByVal Diameter As Single) As Boolean
        If Diameter = CSng(12.7) Then
            Return True
        Else
            Return False
        End If
    End Function

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 5

SRSDS
Advisor
Advisor

Thanks again!!

0 Likes
Message 4 of 5

sbarlage
Enthusiast
Enthusiast

I think this will do it too:

 

If Diameter = 12.7# Then end if

0 Likes
Message 5 of 5

_gile
Consultant
Consultant

Hi,

 

Don't make VB more verbose than it is...

 

    Function Volume(ByVal Diameter As Single) As Boolean
        Return Diameter = 12.7F
    End Function

 But why using a Single rather than a Double ?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes