From 4e0db77a0c3cc4483b3b5f4f81d306869eef656a Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Thu, 15 Oct 2015 20:37:29 -0400 Subject: [PATCH 1/7] Added information about out parameters in C#. --- csharp.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/csharp.html.markdown b/csharp.html.markdown index 7aca2c6f..c32fb9f3 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -7,6 +7,7 @@ contributors: - ["Shaun McCarthy", "http://www.shaunmccarthy.com"] - ["Wouter Van Schandevijl", "http://github.com/laoujin"] - ["Jo Pearce", "http://github.com/jdpearce"] + - ["Chris Zimmerman", "https://github.com/chriszimmerman"] filename: LearnCSharp.cs --- @@ -394,6 +395,7 @@ on a new line! ""Wow!"", the masses cried"; ref int maxCount, // Pass by reference out int count) { + //the argument passed in as 'count' will hold the value of 15 outside of this function count = 15; // out param must be assigned before control leaves the method } From 6a173cb28d6b2565e63fd3e0c05e6627043ba48b Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Thu, 15 Oct 2015 20:39:37 -0400 Subject: [PATCH 2/7] Fixed spacing. --- csharp.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp.html.markdown b/csharp.html.markdown index c32fb9f3..26d4dffc 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -395,8 +395,8 @@ on a new line! ""Wow!"", the masses cried"; ref int maxCount, // Pass by reference out int count) { - //the argument passed in as 'count' will hold the value of 15 outside of this function - count = 15; // out param must be assigned before control leaves the method + //the argument passed in as 'count' will hold the value of 15 outside of this function + count = 15; // out param must be assigned before control leaves the method } // GENERICS From 0671147741c186d27ae055fdceea71b06ec94f20 Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Thu, 15 Oct 2015 20:41:22 -0400 Subject: [PATCH 3/7] Fixed more spacing issues. --- csharp.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp.html.markdown b/csharp.html.markdown index 26d4dffc..59f3e42b 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -395,8 +395,8 @@ on a new line! ""Wow!"", the masses cried"; ref int maxCount, // Pass by reference out int count) { - //the argument passed in as 'count' will hold the value of 15 outside of this function - count = 15; // out param must be assigned before control leaves the method + //the argument passed in as 'count' will hold the value of 15 outside of this function + count = 15; // out param must be assigned before control leaves the method } // GENERICS From d8001da79909734d333de31079ca2f4d884a6b21 Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Thu, 15 Oct 2015 20:59:18 -0400 Subject: [PATCH 4/7] Added an alternative way to fire up a process in Elixir. --- elixir.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elixir.html.markdown b/elixir.html.markdown index c8599838..9fdf37e9 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -384,6 +384,8 @@ end # Compile the module and create a process that evaluates `area_loop` in the shell pid = spawn(fn -> Geometry.area_loop() end) #=> #PID<0.40.0> +#Alternatively +pid = spawn(Geometry, :area_loop, []) # Send a message to `pid` that will match a pattern in the receive statement send pid, {:rectangle, 2, 3} From 65f951d87c80deff6c447faa4690dcfe1bb4d36a Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Sat, 17 Oct 2015 19:37:47 -0400 Subject: [PATCH 5/7] Added documentation on receive do blocks in Elixir. --- elixir.html.markdown | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/elixir.html.markdown b/elixir.html.markdown index 9fdf37e9..60f0b01c 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -369,6 +369,13 @@ spawn(f) #=> #PID<0.40.0> # messages to the process. To do message passing we use the `send` operator. # For all of this to be useful we need to be able to receive messages. This is # achieved with the `receive` mechanism: + +# The `receive do` block is used to listen for messages and process +# them when they are received. A `receive do` block will only +# process one received message. In order to process multiple +# messages, a function with a `receive do` block must recursively +# call itself to get into the `receive do` block again. + defmodule Geometry do def area_loop do receive do From 9f510f3044138429ce616c390e42d8e0b6ceb2df Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Sat, 17 Oct 2015 19:50:09 -0400 Subject: [PATCH 6/7] Fixed indentation in csharp file. --- csharp.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp.html.markdown b/csharp.html.markdown index 59f3e42b..31c0417e 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -395,8 +395,8 @@ on a new line! ""Wow!"", the masses cried"; ref int maxCount, // Pass by reference out int count) { - //the argument passed in as 'count' will hold the value of 15 outside of this function - count = 15; // out param must be assigned before control leaves the method + //the argument passed in as 'count' will hold the value of 15 outside of this function + count = 15; // out param must be assigned before control leaves the method } // GENERICS From 07e04e7a2d0f2b7269e4495c338b039a30f70e64 Mon Sep 17 00:00:00 2001 From: "chris@chriszimmerman.net" Date: Sat, 17 Oct 2015 20:49:58 -0400 Subject: [PATCH 7/7] Fixed spacing with Elixir comment. --- elixir.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elixir.html.markdown b/elixir.html.markdown index 60f0b01c..eedeb227 100644 --- a/elixir.html.markdown +++ b/elixir.html.markdown @@ -391,7 +391,7 @@ end # Compile the module and create a process that evaluates `area_loop` in the shell pid = spawn(fn -> Geometry.area_loop() end) #=> #PID<0.40.0> -#Alternatively +# Alternatively pid = spawn(Geometry, :area_loop, []) # Send a message to `pid` that will match a pattern in the receive statement