Ok, I'm new to programming and just picked up VB .NET for my first language as I need to use it in school.
I have a For loop, with a set of conditional statements in it (2 sets of nested If Else checks), and all this is in a Function. The function should return a boolean value, but I'm not sure how to return a value from inside the If Else checks.
Example:
Not sure if that code helps any, but the function should return true if the age and gender passed into the function appears in the 'data' array of structures as a structure.
Any help would be awesome... I'm an utter noob and I can't seem to work out this scoping for crap!
Cheers in advance to anyone
I have a For loop, with a set of conditional statements in it (2 sets of nested If Else checks), and all this is in a Function. The function should return a boolean value, but I'm not sure how to return a value from inside the If Else checks.
Example:
VB.NET:
Public Function Check(ByVal age As Integer, ByVal gender As String) As Boolean
Dim data As getData() ' returns an array of structrues...
Dim i As Integer
Dim maxValue As Integer = 5
For i = 1 To maxValue
If data(i).age = age Then
If data(i).gender = gender Then
Return True ' this is the part i need help with...
End If
End If
Next
End Function
Not sure if that code helps any, but the function should return true if the age and gender passed into the function appears in the 'data' array of structures as a structure.
Any help would be awesome... I'm an utter noob and I can't seem to work out this scoping for crap!
Cheers in advance to anyone