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?
Printable View
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?
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.
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??
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..?
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?
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.
Oh okay I see now. Thank you!!
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.
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
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.
Actually, I stand corrected. The documentation for the Type.IsPrimitive property says this:
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.Quote:
The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.
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.
Great help!! Thank you everyone!!