dcsimg
Results 1 to 14 of 14

Thread: [RESOLVED] Data Types

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018
    Posts
    136

    Resolved [RESOLVED] Data Types

    What are 4 of the simple data types you're most likely to use in vb.net and what types of data are they used for?

  2. #2
    Fanatic Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,023

    Re: Data Types

    https://docs.microsoft.com/en-us/dot...a-type-summary - although it just sounds like your question is a cut and paste from something asked in class.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018
    Posts
    136

    Re: Data Types

    I know what all the data types are but I wasn't sure which ones are considered the simple data types..
    I figured it was boolean, string, integer, and byte??

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,712

    Re: Data Types

    I would swap Double for byte, certainly. The others I'd say I agree with. Technically, a string is not a simple data type, so you might swap byte for string, but a string is such a fundamental data type to all kinds of programming that special attention has been given to it to make it look and act more simple than it really is, so it really comes down to your definition of "simple". It's certainly fundamental, but whether or not it is simple is harder to say.

    I think Double should clearly be included, these days. Whether byte should be is harder to say. It is very simple, and very fundamental, but also relatively rarely used. It's far more simple than a string, yet far less commonly used. So, while I do think double should be one of your four, whether string or byte is the fourth is harder to say.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018
    Posts
    136

    Re: Data Types

    Quote Originally Posted by Shaggy Hiker View Post
    I would swap Double for byte, certainly. The others I'd say I agree with. Technically, a string is not a simple data type, so you might swap byte for string, but a string is such a fundamental data type to all kinds of programming that special attention has been given to it to make it look and act more simple than it really is, so it really comes down to your definition of "simple". It's certainly fundamental, but whether or not it is simple is harder to say.

    I think Double should clearly be included, these days. Whether byte should be is harder to say. It is very simple, and very fundamental, but also relatively rarely used. It's far more simple than a string, yet far less commonly used. So, while I do think double should be one of your four, whether string or byte is the fourth is harder to say.
    The book I have says Boolean, integer, double, single, string, and date data types are considered simple..which is obviously more than 4 so I was asking to double check. Also what does it mean what data is it used for?

    Does that mean for instance Boolean is either true or false and so on..?

  6. #6
    Fanatic Member
    Join Date
    Nov 2017
    Posts
    724

    Re: Data Types

    Sometimes it is easy to overthink this type of question.

    Imagine you were writing a simple program to process and display reservations for a hotel, where some guests have membership cards and receive a room at a 10% discount. The program asks the user to input all data needed to make a reservation and at the end will display the total cost (including tax) for the stay.

    What data would be Strings?
    What data would be Integers?
    What data would be Double?
    What data would be Boolean?

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,712

    Re: Data Types

    Quote Originally Posted by EmilyM1105 View Post
    The book I have says Boolean, integer, double, single, string, and date data types are considered simple..which is obviously more than 4 so I was asking to double check. Also what does it mean what data is it used for?

    Does that mean for instance Boolean is either true or false and so on..?
    Where were you asked for four? Perhaps the point was to see if you could remember four out of the six types listed, in which case any four would work. Interesting that Byte isn't one of them. Also interesting that Date IS one of them. Dates turn out to be terribly complicated in reality.
    My usual boring signature: Nothing

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018
    Posts
    136

    Re: Data Types

    Oh okay I see now. Thank you!!

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,166

    Re: Data Types

    Quote Originally Posted by EmilyM1105 View Post
    I know what all the data types are but I wasn't sure which ones are considered the simple data types..
    I figured it was boolean, string, integer, and byte??
    It depends what is meant by "simple". I would suggest that it is intended to mean fundamental to the language, which means that every one listed on that page is simple. In VB.NET, if you use a type name and it turns blue then it is a data type that is inherently supported by the language.

  10. #10
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,337

    Re: Data Types

    Quote Originally Posted by jmcilhinney View Post
    It depends what is meant by "simple".
    I would guess they mean primitive types ... they shouldn't use the term simple.

    Also I would personally say:
    String, Boolean, Integer, Decimal ...
    I think those would be the ones that I use most ... although technically a string in .Net is no longer a primitive type ... but it is still handled like one, and most people would think that it is .

    Kris

  11. #11
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,166

    Re: Data Types

    Quote Originally Posted by i00 View Post
    I would guess they mean primitive types ... they shouldn't use the term simple.
    It depends what you mean by "primitive". If you mean "basic" then String is not primitive and "simple" is a reasonably good synonym anyway. If you mean "built-in" then String is primitive and "simple" is not a good synonym because String would be complex. Personally, I tend to equate "primitive" to "built-in" for modern languages like VB.NET because I think that it is more useful. That said, String is officially not considered to be primitive in Java. I don't think Microsoft really use the term "primitive" officially at all when it comes to C# or VB.NET.

  12. #12
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,166

    Re: Data Types

    Quote Originally Posted by jmcilhinney View Post
    I don't think Microsoft really use the term "primitive" officially at all when it comes to C# or VB.NET.
    Actually, I stand corrected. The documentation for the Type.IsPrimitive property says this:
    The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.
    That indicates that String, Date and Decimal are not primitive types despite being built-in types, while IntPtr and UIntPtr are primitive types despite not being built-in types.
    Last edited by jmcilhinney; Mar 15th, 2018 at 08:45 PM.

  13. #13
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,166

    Re: Data Types

    Also note that MSDN does use the term "built-in data types" when it comes to C#:

    https://docs.microsoft.com/en-us/dot...in-types-table

    For VB though, they use the term "elementary data types":

    https://docs.microsoft.com/en-us/dot...ary-data-types

    In both cases though, they mean a type for which there is a language keyword. That second link leads to a page that contains the same link as was provided by PlausiblyDamp in post #2.

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018
    Posts
    136

    Re: Data Types

    Great help!! Thank you everyone!!

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
  •  



Featured


Click Here to Expand Forum to Full Width