Browse Source

Merge pull request #78 from hallzy/add-exit-to-system-docs

Added System.exit() to the docs
Marco Bambini 8 years ago
parent
commit
c9e6e65a44
1 changed files with 15 additions and 0 deletions
  1. 15 0
      docs/system.html

+ 15 - 0
docs/system.html

@@ -124,6 +124,21 @@
 	}
 				</code></pre>
 				
+				<h4 class="section-h4">System Exit</h4>
+				<p>There are times where it could be useful to have main() return an
+				error code back to your shell:</p>
+				<pre><code class="swift">
+	func main() {
+		foo(); // Do something useful
+		System.exit(5);
+	}
+				</code></pre>
+				<p>In your terminal, you can now reference the return code:
+				<pre><code class="bash">
+	# Returns: 5
+	$ echo $?
+				</code></pre>
+				
          	</div>
          	<!-- END CONTENT -->