Results 1 to 6 of 6

Thread: Case Statement Issue VS 2010 Plz Help

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2014
    Posts
    73

    Question Case Statement Issue VS 2010 Plz Help

    So Im Using The Case Statement In My Chat Bot Application And From My Code Below You Will See The Line "Do You Think I Am Nice" , Now , im trying to make it so that if you type in anything other than "yes" or "no" then it says "I Did Not Understand That". I tried using a case else statement and that did not work . any ideas ?



    Code:
    Console.ForegroundColor = ConsoleColor.Yellow
            Console.WriteLine("Do You Think I Am Nice ?")
            Select Case Console.ReadLine.ToLower
    
                Case "yes", "no"
    
    
                    Console.WriteLine("Thank You , I'm Glad You Like me :) , Do You Like Thanksgiving ?")
                    Response3 = Console.ReadLine.ToUpper
    
                    If Response3 = "yes" Then
                        Console.WriteLine("Me Too , I Wish I Could Eat Turkey Though ....")
                        Console.WriteLine("Since I Am A Computer")
                    ElseIf Response3 = "no" Then
                        Console.WriteLine("Nice")
    
                    Else
                        Console.ForegroundColor = ConsoleColor.Red
                        Console.WriteLine("I Didn't Understand That.")
                        Console.WriteLine("-----------------------------")
                        Console.ReadLine()
                        End
                    End If
    
                Case "no", "nah"
                    Console.ForegroundColor = ConsoleColor.Yellow
                    Console.WriteLine(":( , Im Sorry , I'll Get You Flowers To Make Up For It , Do You Like Flowers ?")
                    Response4 = Console.ReadLine().ToLower
                    If Response4 = "yes" Then
                        Console.WriteLine("Okay I'll Talk To You Later , Im Off To Get Sunflowers , Bye")
                    ElseIf Response4 = "no" Then
                        Console.WriteLine("Okay , Ill Try To Be A Better Robot , Bye")
                    Else
                        Console.ForegroundColor = ConsoleColor.Red
                        Console.WriteLine("I Didn't Understand That")
                        Console.WriteLine("-----------------------------")
                        Console.ReadLine()
                        End
                    End If
    
            End Select
            Console.ReadLine()
    
    
        End Sub
    
    End Module
    Last edited by dday9; Nov 24th, 2014 at 04:36 PM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width