mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
minor fixes
This commit is contained in:
parent
0bd403fdb9
commit
947c137680
@ -37,29 +37,30 @@ int main (int argc, const char * argv[])
|
|||||||
NSLog(@"Hello %@!", worldString); // Print "Hello World!"
|
NSLog(@"Hello %@!", worldString); // Print "Hello World!"
|
||||||
|
|
||||||
// Character literals
|
// Character literals
|
||||||
NSNumber *theLetterZ = @'Z';
|
NSNumber *theLetterZNumber = @'Z';
|
||||||
NSLog(@"%c", [theLetterZ charValue]);
|
char theLetterZ = [theLetterZNumber charValue];
|
||||||
|
NSLog(@"%c", theLetterZ);
|
||||||
|
|
||||||
// Integral literals
|
// Integral literals
|
||||||
NSNumber *fortyTwoNumber = @42;
|
NSNumber *fortyTwoNumber = @42;
|
||||||
int fortyTwo = [fortyTwo intValue];
|
int fortyTwo = [fortyTwoNumber intValue];
|
||||||
NSLog(@"%i", fortyTwo);
|
NSLog(@"%i", fortyTwo);
|
||||||
|
|
||||||
NSNumber *fortyTwoUnsignedNumber = @42U;
|
NSNumber *fortyTwoUnsignedNumber = @42U;
|
||||||
unsigned int fortyTwoUnsigned = [fortyTwoUnsigned unsignedIntValue];
|
unsigned int fortyTwoUnsigned = [fortyTwoUnsignedNumber unsignedIntValue];
|
||||||
NSLog(@"%u", fortyTwoUnsigned);
|
NSLog(@"%u", fortyTwoUnsigned);
|
||||||
|
|
||||||
NSNumber *fortyTwoLongNumber = @42L;
|
NSNumber *fortyTwoLongNumber = @42L;
|
||||||
long fortyTwoLong = [aLong longValue];
|
long fortyTwoLong = [fortyTwoLongNumber longValue];
|
||||||
NSLog(@"%li", fortyTwoLong);
|
NSLog(@"%li", fortyTwoLong);
|
||||||
|
|
||||||
// Floating point literals
|
// Floating point literals
|
||||||
NSNumber *piFloatNumber = @3.141592654F;
|
NSNumber *piFloatNumber = @3.141592654F;
|
||||||
float piFloat = [piFloat floatValue];
|
float piFloat = [piFloatNumber floatValue];
|
||||||
NSLog(@"%f", piFloat);
|
NSLog(@"%f", piFloat);
|
||||||
|
|
||||||
NSNumber *piDoubleNumber = @3.1415926535;
|
NSNumber *piDoubleNumber = @3.1415926535;
|
||||||
piDouble = [piDouble doubleValue];
|
piDouble = [piDoubleNumber doubleValue];
|
||||||
NSLog(@"%f", piDouble);
|
NSLog(@"%f", piDouble);
|
||||||
|
|
||||||
// BOOL literals
|
// BOOL literals
|
||||||
|
Loading…
Reference in New Issue
Block a user