-
Notifications
You must be signed in to change notification settings - Fork 5.8k
/
numeric-literals.vb
309 lines (259 loc) · 8.83 KB
/
numeric-literals.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
Option Strict On
Public Module Example
Public Sub Main()
Console.WriteLine("Byte Assignments:")
AssignByte()
Console.WriteLine()
Console.WriteLine("Byte Assignments with Separator:")
AssignByteWithSeparator()
Console.WriteLine()
Console.WriteLine("Short Assignments:")
AssignShort()
Console.WriteLine()
Console.WriteLine("Short Assignments with Separator:")
AssignShortWithSeparator()
Console.WriteLine()
Console.WriteLine("Integer Assignments:")
AssignInteger()
Console.WriteLine()
Console.WriteLine("Integer Assignments with Separator:")
AssignIntegerWithSeparator()
Console.WriteLine()
Console.WriteLine("Long Assignments:")
AssignLong()
Console.WriteLine()
Console.WriteLine("Long Assignments with Separator:")
AssignLongWithSeparator()
Console.WriteLine()
Console.WriteLine("Signed Byte Assignments:")
AssignSByte()
Console.WriteLine()
Console.WriteLine("Signed Byte Assignments with Separator:")
AssignSByteWithSeparator()
Console.WriteLine()
Console.WriteLine("UShort Assignments:")
AssignUShort()
Console.WriteLine()
Console.WriteLine("UShort Assignments with Separator:")
AssignUShortWithSeparator()
Console.WriteLine()
Console.WriteLine("UInteger Assignments:")
AssignUInteger()
Console.WriteLine()
Console.WriteLine("UInteger Assignments with Separator:")
AssignUIntegerWithSeparator()
Console.WriteLine()
Console.WriteLine("ULong Assignments:")
AssignULong()
Console.WriteLine()
Console.WriteLine("ULong Assignments with Separator:")
AssignULongWithSeparator()
Console.WriteLine()
End Sub
Private Sub AssignByte()
' <SnippetByte>
Dim byteValue1 As Byte = 201
Console.WriteLine(byteValue1)
Dim byteValue2 As Byte = &H00C9
Console.WriteLine(byteValue2)
Dim byteValue3 As Byte = &B1100_1001
Console.WriteLine(byteValue3)
' The example displays the following output:
' 201
' 201
' 201
' </SnippetByte>
End Sub
Private Sub AssignByteWithSeparator()
' <SnippetByteS>
Dim byteValue3 As Byte = &B1100_1001
Console.WriteLine(byteValue3)
' The example displays the following output:
' 201
' </SnippetByteS>
End Sub
Private Sub AssignShort()
' <SnippetShort>
Dim shortValue1 As Short = 1034
Console.WriteLine(shortValue1)
Dim shortValue2 As Short = &H040A
Console.WriteLine(shortValue2)
Dim shortValue3 As Short = &B0100_00001010
Console.WriteLine(shortValue3)
' The example displays the following output:
' 1034
' 1034
' 1034
' </SnippetShort>
End Sub
Private Sub AssignShortWithSeparator()
' <SnippetShortS>
Dim shortValue1 As Short = 1_034
Console.WriteLine(shortValue1)
Dim shortValue3 As Short = &B00000100_00001010
Console.WriteLine(shortValue3)
' The example displays the following output:
' 1034
' 1034
' </SnippetShortS>
End Sub
Private Sub AssignInteger()
' <SnippetInt>
Dim intValue1 As Integer = 90946
Console.WriteLine(intValue1)
Dim intValue2 As Integer = &H16342
Console.WriteLine(intValue2)
Dim intValue3 As Integer = &B0001_0110_0011_0100_0010
Console.WriteLine(intValue3)
' The example displays the following output:
' 90946
' 90946
' 90946
' </SnippetInt>
End Sub
Private Sub AssignIntegerWithSeparator()
' <SnippetIntS>
Dim intValue1 As Integer = 90_946
Console.WriteLine(intValue1)
Dim intValue2 As Integer = &H0001_6342
Console.WriteLine(intValue2)
Dim intValue3 As Integer = &B0001_0110_0011_0100_0010
Console.WriteLine(intValue3)
' The example displays the following output:
' 90946
' 90946
' 90946
' </SnippetIntS>
End Sub
Private Sub AssignLong()
' <SnippetLong>
Dim longValue1 As Long = 4294967296
Console.WriteLine(longValue1)
Dim longValue2 As Long = &H100000000
Console.WriteLine(longValue2)
Dim longValue3 As Long = &B1_0000_0000_0000_0000_0000_0000_0000_0000
Console.WriteLine(longValue3)
' The example displays the following output:
' 4294967296
' 4294967296
' 4294967296
' </SnippetLong>
End Sub
Private Sub AssignLongWithSeparator()
' <SnippetLongS>
Dim longValue1 As Long = 4_294_967_296
Console.WriteLine(longValue1)
Dim longValue2 As Long = &H1_0000_0000
Console.WriteLine(longValue2)
Dim longValue3 As Long = &B1_0000_0000_0000_0000_0000_0000_0000_0000
Console.WriteLine(longValue3)
' The example displays the following output:
' 4294967296
' 4294967296
' 4294967296
' </SnippetLongS>
End Sub
Private Sub AssignSByte()
' <SnippetSByte>
Dim sbyteValue1 As SByte = -102
Console.WriteLine(sbyteValue1)
Dim sbyteValue4 As SByte = &H9A
Console.WriteLine(sbyteValue4)
Dim sbyteValue5 As SByte = &B1001_1010
Console.WriteLine(sbyteValue5)
' The example displays the following output:
' -102
' -102
' -102
' </SnippetSByte>
End Sub
Private Sub AssignSByteWithSeparator()
' <SnippetSByteS>
Dim sbyteValue3 As SByte = &B1001_1010
Console.WriteLine(sbyteValue3)
' The example displays the following output:
' -102
' </SnippetSByteS>
End Sub
Private Sub AssignUShort()
' <SnippetUShort>
Dim ushortValue1 As UShort = 65034
Console.WriteLine(ushortValue1)
Dim ushortValue2 As UShort = &HFE0A
Console.WriteLine(ushortValue2)
Dim ushortValue3 As UShort = &B1111_1110_0000_1010
Console.WriteLine(ushortValue3)
' The example displays the following output:
' 65034
' 65034
' 65034
' </SnippetUShort>
End Sub
Private Sub AssignUShortWithSeparator()
' <SnippetUShortS>
Dim ushortValue1 As UShort = 65_034
Console.WriteLine(ushortValue1)
Dim ushortValue3 As UShort = &B11111110_00001010
Console.WriteLine(ushortValue3)
' The example displays the following output:
' 65034
' 65034
' </SnippetUShortS>
End Sub
Private Sub AssignUInteger()
' <SnippetUInt>
Dim uintValue1 As UInteger = 3000000000ui
Console.WriteLine(uintValue1)
Dim uintValue2 As UInteger = &HB2D05E00ui
Console.WriteLine(uintValue2)
Dim uintValue3 As UInteger = &B1011_0010_1101_0000_0101_1110_0000_0000ui
Console.WriteLine(uintValue3)
' The example displays the following output:
' 3000000000
' 3000000000
' 3000000000
' </SnippetUInt>
End Sub
Private Sub AssignUIntegerWithSeparator()
' <SnippetUIntS>
Dim uintValue1 As UInteger = 3_000_000_000ui
Console.WriteLine(uintValue1)
Dim uintValue2 As UInteger = &HB2D0_5E00ui
Console.WriteLine(uintValue2)
Dim uintValue3 As UInteger = &B1011_0010_1101_0000_0101_1110_0000_0000ui
Console.WriteLine(uintValue3)
' The example displays the following output:
' 3000000000
' 3000000000
' 3000000000
' </SnippetUIntS>
End Sub
Private Sub AssignULong()
' <SnippetULong>
Dim ulongValue1 As ULong = 7934076125
Console.WriteLine(ulongValue1)
Dim ulongValue2 As ULong = &H0001D8e864DD
Console.WriteLine(ulongValue2)
Dim ulongValue3 As ULong = &B0001_1101_1000_1110_1000_0110_0100_1101_1101
Console.WriteLine(ulongValue3)
' The example displays the following output:
' 7934076125
' 7934076125
' 7934076125
' </SnippetULong>
End Sub
Private Sub AssignULongWithSeparator()
' <SnippetULongS>
Dim ulongValue1 As ULong = 7_934_076_125
Console.WriteLine(ulongValue1)
Dim ulongValue2 As ULong = &H0001_D8e8_64DD
Console.WriteLine(ulongValue2)
Dim ulongValue3 As ULong = &B0000_0001_1101_1000_1110_1000_0110_0100_1101_1101
Console.WriteLine(ulongValue3)
' The example displays the following output:
' 7934076125
' 7934076125
' 7934076125
' </SnippetULongS>
End Sub
End Module