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

  • SEARCH
  • Home
  • 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 8386657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:00:13+00:00 2026-06-09T18:00:13+00:00

What I would like is to basically have the user enter in a float,

  • 0

What I would like is to basically have the user enter in a float, and then the system check that the input is indeed a float, and if it is then it will proceed with the code, and if it is not then the user will have to re-input the with the correct data type.
Sorry for the beginners question, an example of the code is:

            Console.Write("Response Value > ");
            Response = float.Parse(Console.ReadLine())

            Ask_Count = Ask_Count + 1;
            if (Response > 0 && Response < 6)
            {
                Valid_Count = Valid_Count + 1;
            }

How would I go about the program checking to see if Response is a float?

Thank you.

  • 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-09T18:00:15+00:00Added an answer on June 9, 2026 at 6:00 pm

    another is by using is float.

    bool result = varName is float;
    

    or

    float x = 0;
    bool result = float.tryParse(varname, out x);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I have a user input field where a user can enter a number.
I would like to know if it is possible to have a user enter
Basically i have a classic vhost with: ServerName www.site.com ServerAlias site.com I would like
I would just like your feedback on something. Basically I have a value called
I would like to have fuzzy looking border around my Canvas control. Basically, I
I would like to add a preprocessor to HTML pages. Basically, I have a
I would like to basically get all the events that i get invited to
I would like to implement captcha when registering to XMPP server. Basically I have
I have a scenario that looks like this: User A is a registered user.
I am learning some myqli and would like to make a simple check. Basically,

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.