-
Notifications
You must be signed in to change notification settings - Fork 89
Basic types print
CodingUnit edited this page Dec 1, 2011
·
7 revisions
-
Category: Arithmetic
-
Description: Basic types print
-
Code:
using System.Console;
def _int = 53;
def _string = "This is a string";
def _char = 'e';
def _bool = true;
def hexint = 0x63;
def octalint = 0o12;
def binaryinteger = 0b110110;
def signedbyte = 81 : sbyte;
def unsignedbyte = 122 : byte;
def smallint = 63 : short;
def smalluint = 61 : ushort;
def integer = 353l;
def usignedint = 351ul;
def nativeint = 7511 : int;
def unsignednativeint = 7653 : uint;
def _long = 12345678912345789L;
def unsignedlong = 12345678912345UL;
def float32 = 12.8F;
def _float = 552.8;
def lst = [1, 2, 3];
WriteLine($"int = {0:d} or $_int", _int);
WriteLine($"string = {0:s} or $_string", _string);
WriteLine($"char = {0:c} or $_char", _char);
WriteLine($"bool = {0:b} or $_bool", _bool);
WriteLine($"hex int = {0:x} or $hexint", hexint);
WriteLine($"HEX INT = {0:X} or $hexint", hexint);
WriteLine($"oct int = $octalint", octalint);
WriteLine($"bin int = {0:d} or $binaryinteger", binaryinteger);
WriteLine($"signed byte = $signedbyte");
WriteLine($"unsigned byte = $unsignedbyte");
WriteLine($"small int = $smallint");
WriteLine($"small uint = $smalluint");
WriteLine($"int = $integer", integer);
WriteLine($"uint = $usignedint", usignedint);
WriteLine($"native int = $nativeint");
WriteLine($"unsigned native int = $unsignednativeint");
WriteLine($"long = {0:d} or $_long", _long);
WriteLine($"unsigned long = $unsignedlong");
WriteLine($"float = {0:f} or $float32", float32);
WriteLine($"double = {0:f} or $_float", _float);
WriteLine($"splice integer operations = $(integer * 210 + 1)");
WriteLine($"list = ..$lst");
WriteLine($<#list with delimiter = ..$(lst; ";")#>);
WriteLine($<#list with operations = ..$(lst; "; "; x => $"x * 2 = $(x * 2)")#>);
- Execution Result:
int = 53
string = This is a string
char = e
bool = True
hex int = 99
HEX INT = 99
oct int = 10
bin int = 54
signed byte = 81
unsigned byte = 122
small int = 63
small uint = 61
int = 353
uint = 351
native int = 7511
unsigned native int = 7653
long = 12345678912345789
unsigned long = 12345678912345
float = 12,8
double = 552,8
splice integer operations = 74131
list = 1, 2, 3
list with delimiter = 1;2;3
list with operations = x \* 2 = 2; x \* 2 = 4; x \* 2 = 6
[Copyright ©](Terms of use, legal notice)