From 3391d5dcb35058bb84b25e45c3338ea00cac9a9f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 14 Jun 2018 08:28:01 +1000 Subject: [PATCH] docs: update --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 5cb5a33..1611d9a 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ scripts and not full blown utilities. * [Get the current cursor position.](#get-the-current-cursor-position) * [Code Golf](#code-golf) * [Shorter `for` loop syntax.](#shorter-for-loop-syntax) + * [Shorter infinite loops.](#shorter-infinite-loops) * [Shorter function declaration.](#shorter-function-declaration) * [Miscellaneous](#miscellaneous) * [Get the current date using `strftime`.](#get-the-current-date-using-strftime) @@ -441,6 +442,16 @@ for i in {1..10}; do echo "$i"; done for((i=0;i<=10;i++)); do echo "$i"; done ``` +### Shorter infinite loops. + +```sh +# Normal method +while :; do code; done + +# Shorter +for((;;)){ code;} +``` + ### Shorter function declaration. ```sh