Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8670121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:38:21+00:00 2026-06-12T18:38:21+00:00

I’m new to visual basic and have been using vb.net to create a console/text

  • 0

I’m new to visual basic and have been using vb.net to create a console/text based game. I want to make my game a little bit more “smart”. The idea I’ve had to do this is to create an array of synonyms for yes and an array of synonyms for no, and similar arrays for over words. I intended on using a case statement with the array to decide weather the users input was a synonym for yes or for no. I have had no luck so far, and I was wondering if anybody here knew how it can be done or if I’m barking up the wrong tree. Maybe there is a different way for me to approach this?

My Select attempt:

Select Case userInput
    Case yes(0) To yes(34)
        Console.WriteLine("you said something like yes, you said {0}", userInput)

End Select

The start of my array: (there are 34 synonyms so far)

Dim yes(0 To 34) As String

yes(0) = "yes"
yes(1) = "ok"
yes(2) = "yep"
yes(3) = "yeah"

If anybody can help me it would be very much appreciated 🙂 Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:38:22+00:00Added an answer on June 12, 2026 at 6:38 pm

    You do not have to use a Select Case for this purpose. A simple List(Of T).Contains can do the trick. Then you can go ahead to put it in a function so you can call it several times in your application.

    Sample Code:

    Public Enum Answer
        Yes
        No
        Other
    End Enum
    
    Public Function GetAnswer(answer As String) As Answer
        Static yesAnswers = New List(Of String)({"yes", "yeah", "yep", "aye"})
        Static noAnswers = New List(Of String)({"no", "nope", "nay"})
    
        If yesAnswers.Contains(answer.ToLower()) Then
            Return Answer.Yes
        ElseIf noAnswers.Contains(answer.ToLower()) Then
            Return Answer.No
        Else
            Return Answer.Cancel
        End If
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.