How do I pass a value from the function?
for example, the loop works, but when entering a number between 0 and 100, I can't get the function to pass the value back. I want the exam1 grade to be worth 10% - so exam1 * 0.1. It needs to be between 0 and 100. I can pass the entered score to the function, get the "error message back" enter a good number, and move on. Once the function is complete, exam1 is eqaul to 0 and not the good value entered. After the function, I want the good number to store into exam1 so I can multiply it by 0.1.
Expand|Select|Wrap|Line Numbers
- Console.Write("Enter grade of Exam 1 : ")
- exam1 = Console.ReadLine()
- exam1 = checkGrade(exam1)
- 'Exam 1 is worth 10% of the total grade.
- Function checkGrade(ByVal check As Double) As Double
- If check < 0 Or check > 100 Then
- Console.Write("****Please enter a grade between 0 and 100: ")
- check = Console.ReadLine()
- check = checkGrade(check)
- Else
- 'Console.Write("check= " & check)
- Return check
- End If
- End Function