Help

There is something wrong with the end if
Function lettergrade(Grade As Integer) As String

If Grade >= 90 Then
lettergrade = "A"
If Grade >= 80 And Grade = 70 And Grade = 60 And Grade = 59 Then
lettergrade = "F"
End If
End Function

Other urls found in this thread:

en.m.wikibooks.org/wiki/BASIC_Programming/Beginning_BASIC/Control_Structures/IF...THEN...ELSEIF...ELSE
twitter.com/NSFWRedditImage

Kill yourself

probably need an end if for each if.

There is a better way to do end If but the tutor won't tell me

>Grade >= 59

...

>End if
>End function
Wat

Why aren't you
using a case/switch statement?

Also, shouldn't it be more like if elsif elsif endif

It's in basic for excel and 59 I know

Conditions are incomplete. What if grade is less than 59?

Plz b troll

I know nothing about Basic and already found your problem

en.m.wikibooks.org/wiki/BASIC_Programming/Beginning_BASIC/Control_Structures/IF...THEN...ELSEIF...ELSE

If I have to rewrite it what it look like

>If Grade >= 59 Then
>lettergrade = "F"
Your problem is here. Where is the "And" for this?

you realise if grade == 100 then this function results in lettergrade being assigned to “F” because you didn’t use return statements? what the fuck is wrong with you?

If your ranges were 91 to 10, 81 to 90 and so on, could be something like


Lettergrade = Asc(65+Int((100-Grade)/10))
If Lettergrade > "F" then
Lettergrade = "F"
End If

What is going on

looking at this code makes me better understand how for real brainlets see the world

You this the the build your own model in excel thing what is wrong with it

>If Grade >= 59 Then
kek, so 59+ is "F" and