From 5720c56026567ebf3d756ae0e8971565e66ab06d Mon Sep 17 00:00:00 2001 From: james sangho nah Date: Sun, 1 Feb 2015 01:32:21 +1300 Subject: Add ranges under 'Basic types' --- elixir.html.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elixir.html.markdown b/elixir.html.markdown index 0a20e3df..fb5f183a 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -91,6 +91,11 @@ string. <<1,2,3>> <> <<4,5>> #=> <<1,2,3,4,5>> "hello " <> "world" #=> "hello world" +# Ranges are represented as `start..end` (both inclusive) +1..10 #=> 1..10 +lower..upper = 1..10 # Can use pattern matching on ranges as well +[lower, upper] #=> [1, 10] + ## --------------------------- ## -- Operators ## --------------------------- -- cgit v1.2.3 From df0dbef198f810d976a76cfb4453d9c99ac2b360 Mon Sep 17 00:00:00 2001 From: Nicholas Hrynuik Date: Sat, 31 Jan 2015 21:38:24 -0500 Subject: Fix typos in objective-c doc --- objective-c.html.markdown | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/objective-c.html.markdown b/objective-c.html.markdown index caad49a5..bac8fb55 100644 --- a/objective-c.html.markdown +++ b/objective-c.html.markdown @@ -55,7 +55,7 @@ int main (int argc, const char * argv[]) id myObject2 = nil; // Weak typing // %@ is an object // 'description' is a convention to display the value of the Objects - NSLog(@"%@ and %@", myObject1, [myObject2 description]); // Print "(null) and (null)" + NSLog(@"%@ and %@", myObject1, [myObject2 description]); // prints "(null) and (null)" // String NSString *worldString = @"World"; @@ -70,7 +70,7 @@ int main (int argc, const char * argv[]) char theLetterZ = [theLetterZNumber charValue]; // or 'Z' NSLog(@"%c", theLetterZ); - // Integral literals + // Integer literals NSNumber *fortyTwoNumber = @42; int fortyTwo = [fortyTwoNumber intValue]; // or 42 NSLog(@"%i", fortyTwo); @@ -128,9 +128,10 @@ int main (int argc, const char * argv[]) // May contain different data types, but must be an Objective-C object NSArray *anArray = @[@1, @2, @3, @4]; NSNumber *thirdNumber = anArray[2]; - NSLog(@"Third number = %@", thirdNumber); // Print "Third number = 3" - // NSMutableArray is mutable version of NSArray allowing to change items in array - // and extend or shrink array object. Convenient, but not as efficient as NSArray + NSLog(@"Third number = %@", thirdNumber); // prints "Third number = 3" + // NSMutableArray is a mutable version of NSArray allowing you to change + // items in array and extend or shrink array object. Convenient, but not + // as efficient as NSArray NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:2]; [mutableArray addObject:@"Hello"]; [mutableArray addObject:@"World"]; @@ -140,7 +141,7 @@ int main (int argc, const char * argv[]) // Dictionary object NSDictionary *aDictionary = @{ @"key1" : @"value1", @"key2" : @"value2" }; NSObject *valueObject = aDictionary[@"A Key"]; - NSLog(@"Object = %@", valueObject); // Print "Object = (null)" + NSLog(@"Object = %@", valueObject); // prints "Object = (null)" // NSMutableDictionary also available as a mutable dictionary object NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithCapacity:2]; [mutableDictionary setObject:@"value1" forKey:@"key1"]; @@ -627,7 +628,7 @@ int main (int argc, const char * argv[]) { @end // Instances of Car now have access to the protocol. Car *carInstance = [[Car alloc] init]; -[[carInstance setEngineOn:NO]; +[carInstance setEngineOn:NO]; [carInstance turnOnEngine]; if ([carInstance engineOn]) { NSLog(@"Car engine is on."); // prints => "Car engine is on." -- cgit v1.2.3 From d406057dc78ef128186ce9b059b04120e21f39b8 Mon Sep 17 00:00:00 2001 From: Nicholas Hrynuik Date: Sat, 31 Jan 2015 22:18:02 -0500 Subject: Further fix of typos in objective-c doc --- objective-c.html.markdown | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/objective-c.html.markdown b/objective-c.html.markdown index bac8fb55..56640a87 100644 --- a/objective-c.html.markdown +++ b/objective-c.html.markdown @@ -55,7 +55,7 @@ int main (int argc, const char * argv[]) id myObject2 = nil; // Weak typing // %@ is an object // 'description' is a convention to display the value of the Objects - NSLog(@"%@ and %@", myObject1, [myObject2 description]); // prints "(null) and (null)" + NSLog(@"%@ and %@", myObject1, [myObject2 description]); // prints => "(null) and (null)" // String NSString *worldString = @"World"; @@ -70,7 +70,7 @@ int main (int argc, const char * argv[]) char theLetterZ = [theLetterZNumber charValue]; // or 'Z' NSLog(@"%c", theLetterZ); - // Integer literals + // Integral literals NSNumber *fortyTwoNumber = @42; int fortyTwo = [fortyTwoNumber intValue]; // or 42 NSLog(@"%i", fortyTwo); @@ -128,10 +128,10 @@ int main (int argc, const char * argv[]) // May contain different data types, but must be an Objective-C object NSArray *anArray = @[@1, @2, @3, @4]; NSNumber *thirdNumber = anArray[2]; - NSLog(@"Third number = %@", thirdNumber); // prints "Third number = 3" - // NSMutableArray is a mutable version of NSArray allowing you to change - // items in array and extend or shrink array object. Convenient, but not - // as efficient as NSArray + NSLog(@"Third number = %@", thirdNumber); // prints => "Third number = 3" + // NSMutableArray is a mutable version of NSArray, allowing you to change + // the items in the array and to extend or shrink the array object. + // Convenient, but not as efficient as NSArray. NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:2]; [mutableArray addObject:@"Hello"]; [mutableArray addObject:@"World"]; @@ -141,7 +141,7 @@ int main (int argc, const char * argv[]) // Dictionary object NSDictionary *aDictionary = @{ @"key1" : @"value1", @"key2" : @"value2" }; NSObject *valueObject = aDictionary[@"A Key"]; - NSLog(@"Object = %@", valueObject); // prints "Object = (null)" + NSLog(@"Object = %@", valueObject); // prints => "Object = (null)" // NSMutableDictionary also available as a mutable dictionary object NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithCapacity:2]; [mutableDictionary setObject:@"value1" forKey:@"key1"]; @@ -211,7 +211,7 @@ int main (int argc, const char * argv[]) while (ii < 4) { NSLog(@"%d,", ii++); // ii++ increments ii in-place, after using its value - } // => prints "0," + } // prints => "0," // "1," // "2," // "3," @@ -221,7 +221,7 @@ int main (int argc, const char * argv[]) for (jj=0; jj < 4; jj++) { NSLog(@"%d,", jj); - } // => prints "0," + } // prints => "0," // "1," // "2," // "3," @@ -231,7 +231,7 @@ int main (int argc, const char * argv[]) for (NSNumber *value in values) { NSLog(@"%@,", value); - } // => prints "0," + } // prints => "0," // "1," // "2," // "3," @@ -239,7 +239,7 @@ int main (int argc, const char * argv[]) // Object for loop statement. Can be used with any Objective-C object type for (id item in values) { NSLog(@"%@,", item); - } // => prints "0," + } // prints => "0," // "1," // "2," // "3," @@ -256,7 +256,7 @@ int main (int argc, const char * argv[]) } @finally { NSLog(@"Finally. Time to clean up."); - } // => prints "Exception: File Not Found on System" + } // prints => "Exception: File Not Found on System" // "Finally. Time to clean up." // NSError objects are useful for function arguments to populate on user mistakes. -- cgit v1.2.3