Make if/else statements work properly in Presented Sheet

I'm having a difficult time running a couple functions on a .sheet when a button is selected. Pretty much, when I select the View Results button and the sheet opens, both functions are running as if they are not of true value, however I do print the values of these Boolean variables as the button is hit and they they print out the correct values.

I have two major toggles here. One called Disabled & the other MedicareBen along with their State's:

    @State var disabled: Bool = false
    @State private var medicareBen: Bool = false

                    

                    Section("Does anyone have:")    {
                        Toggle(isOn: self.$medicareBen) { Text("Medicare")}
                        .tint(.blue)
                        Toggle(isOn: self.$disabled) { Text("A Disablility")}
                        .tint(.blue)
                    }

I have two functions that determine the Booleans final value: The first function below, mspEligibility() below primarily involves the MedicareBen toggle above, while the second function, ssdiEligibility() involves the disabled button above.

    @State var elig: Bool = false
    
    func mspEligibility() {    
        if hhmembers == 1 && age >= 17 && income <= 1449 && incomefreq == .Monthly && mspBen == false && medicareBen == true && marital == .Single || marital == .Divorce || marital == .Widow {
            print("MSP Eligible 1")
            elig = true
        } else if hhmembers == 1 && age >= 17 && income <= 17388 && incomefreq == .Yearly && mspBen == false && medicareBen == true && marital == .Single || marital == .Divorce || marital == .Widow {
            print("MSP Eligible 1")
            elig = true
        } else if medicareBen == false {
            print("Not MSP Eligible")
            elig = false
        } else if ssiBen == true || medicaidBen == true || mspBen == true || marital == .Married {
            print("Not MSP Eligible")
            elig = false
        } else if hhmembers >= 2 {
            print("Not MSP Eligible")
            elig = false
        } else {
            print("Not MSP Eligible")
            elig = false
        }
    }

The function that involves the Disabled toggle:

   @State var ssdiElig: Bool = false
   
    func ssdiEligibility() {
        if disabled == true && income <= 803 {
            print("SSDI Eligible")
            ssdiElig = true
            disabled = true
        } else if ssdiBen == true || ssiBen == true {
            print("Not SSDI Eligible")
            ssdiElig = false
            disabled = false
        } else {
            print("Not SSDI Eligible")
            ssdiElig = false
            disabled = false
        }
    }

Below is the button, which carries a bunch of different Eligibility functions that aren't really involved here. However, the button also presents a .sheet has 2 conditional statements that are a bit flaky. As I mentioned you'll see I print a few different things in the console, print(elig) , print(ssdiElig) , print(disabled), the Boolean values end up coming up as expected based on the prior functions I pasted above but it seems I have to toggle the disability button or Medicare button a couple times before the if conditions work properly. Is there a way around this? Or, maybe somehow binding them to another View the sheet opens? any thoughts?

               ZStack {
                   VStack {
                        Button(action: {mspEligibility(); ssdiEligibility(); ssiEligibility(); mspEligibility2(); PAzipcode(); mspEligibility3();
                            self.isOpen = true
                            print(elig)
                            print(ssdiElig)
                            print(disabled)                            
                        }, label: {                            
                            Text("View Results")                         
                        }).sheet(isPresented: $isOpen, content: {
                            if ssdiElig {
                                ZStack {
                                   RoundedRectangle(cornerRadius: 25)
                                       .fill(Color.white)
                                        .frame(width: 375, height: 125)
                                        .shadow(color: Color.black.opacity(0.5), radius: 10, x: 10, y: 10)
                                        .shadow(color: Color.white.opacity(0.7), radius: 10, x: -5, y: -5)
                                    HStack {
                                        Text("Eligible for SSDI")
                                            .font(.headline)
                                            .padding(60)
                                        Image(systemName: "face.dashed")
                                            .resizable()
                                            .frame(width: 60, height: 60)
                                            .padding(7)
                                    }
                                }
                            } else {
                                Text("No")
                            }
                                if elig == true {                                  
                                    Text("Eligible for MSP")
                                    ZStack {
                                        RoundedRectangle(cornerRadius: 25)
                                            .fill(Color.white)
                                            .frame(width: 375, height: 125)
                                            .shadow(color: Color.black.opacity(0.5), radius: 10, x: 10, y: 10)
                                           .shadow(color: Color.white.opacity(0.7), radius: 10, x: -5, y: -5)
                                        HStack {
                                           Text("Eligible for MSP")
                                            .font(.headline)
                                            .padding(60)
                                            Image(systemName: "face.dashed")
                                                .resizable()
                                               .frame(width: 60, height: 60)
                                               .padding(7)
                                        }
                                    }
                                } else {
                                    Text("No")
                                }
                        }
                    )}
                }

Some comments first.

For better readability and avoid precedence issues, you'd better use parenthesis here:

        if hhmembers == 1 && age >= 17 && income <= 1449 && incomefreq == .Monthly && mspBen == false && medicareBen == true && (marital == .Single || marital == .Divorce || marital == .Widow) {

 it seems I have to toggle the disability button or Medicare button a couple times before the if conditions work properly. 

Where is the code of this button ?

Could you also tell what you get on screen exactly, after first hit of button, second hit, third hit… And yo make it clearer, put more explicit messages: instead of

                                Text("No")

put for instance

                                Text("Not Eligible for SSDI")

Hey @Claude31, thanks for responding! Since I'm unable to edit my question here's some further details.

The code I have for the button is this, where once the button is selected, under action: in the button, you'll see the two functions that when initiate when button is clicked, Button(action: {mspEligibility(); ssdiEligibility(); Let me know if this is not the button code you're referring too

 ZStack {
                   VStack {
                        Button(action: {mspEligibility(); ssdiEligibility(); ssiEligibility(); mspEligibility2(); PAzipcode(); mspEligibility3();
                            self.isOpen = true
                            print(elig)
                            print(ssdiElig)
                            print(disabled)                            
                        }, label: {                            
                            Text("View Results")                         
                        }).sheet(isPresented: $isOpen, content: {

So, basically in the function

Also, I took your suggestion with using parenthesis in the mspEligibility() function itself and more clearer explicit messages.

Here are a couple screen shots on a URL: https://imgur.com/a/mbONe0C . The first is when I select the disability toggle, and the 2nd is when I select the View Results button, which shows Not Eligible for SSDI when as you can see it's printed out Eligible from the function. Then when I go back and plug true value for both Disability and Medicare, and select the View Results button: they both show as eligible (also screen shot on the URL).

Please let me know if I'm missing anything else from this post or my initial post, I believe I have everything that's needed. Thanks!

Make if/else statements work properly in Presented Sheet
 
 
Q