From ccca29377a48da6dabbb08446ec7c3299f9165b9 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 1 Mar 2015 15:28:37 +0100 Subject: Fix Nim a bit --- nim.html.markdown | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index c74fece7..2172f40f 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -3,14 +3,15 @@ language: Nim filename: learnNim.nim contributors: - ["Jason J. Ayala P.", "http://JasonAyala.com"] + - ["Dennis Felsing", "http://felsin9.de/nnis/"] --- -Nim (formally Nimrod) is a statically typed, imperative programming language +Nim (formerly Nimrod) is a statically typed, imperative programming language that gives the programmer power without compromises on runtime efficiency. Nim is efficient, expressive, and elegant. -```ruby +```nimrod var # Declare (and assign) variables, letter: char = 'n' # with or without type annotations lang = "N" & "im" @@ -60,6 +61,13 @@ var drinks = @["Water", "Juice", "Chocolate"] # @[V1,..,Vn] is the sequence literal +drinks.add("Milk") + +if "Milk" in drinks: + echo "We have Milk and ", drinks.len - 1, " other drinks" + +let myDrink = drinks[2] + # # Defining Types # -- cgit v1.2.3 From 0bb2a2ddc1ef1f55db6c5856cec3e01c49c89b01 Mon Sep 17 00:00:00 2001 From: Ben Wiklund Date: Sun, 1 Mar 2015 13:28:12 -0800 Subject: Update nim.html.markdown --- nim.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index 2172f40f..aa15e591 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -269,5 +269,5 @@ performance, and compile-time features. * [FAQ](http://nimrod-lang.org/question.html) * [Documentation](http://nimrod-lang.org/documentation.html) * [Manual](http://nimrod-lang.org/manual.html) -* [Standard Libray](http://nimrod-lang.org/lib.html) +* [Standard Library](http://nimrod-lang.org/lib.html) * [Rosetta Code](http://rosettacode.org/wiki/Category:Nimrod) -- cgit v1.2.3 From 6df96946b43999ff8754807446d4bf4f73144480 Mon Sep 17 00:00:00 2001 From: Baurzhan Muftakhidinov Date: Mon, 18 May 2015 14:17:45 +0500 Subject: Fix links to nim-lang website. --- nim.html.markdown | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index aa15e591..2955c7bc 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -155,7 +155,7 @@ var anotherArray = ["Default index", "starts at", "0"] # More data structures are available, including tables, sets, lists, queues, # and crit bit trees. -# http://nimrod-lang.org/lib.html#collections-and-algorithms +# http://http://nim-lang.org/docs/lib.html#collections-and-algorithms # # IO and Control Flow @@ -174,7 +174,7 @@ else: # `while`, `if`, `continue`, `break` -import strutils as str # http://nimrod-lang.org/strutils.html +import strutils as str # http://nim-lang.org/docs/strutils.html echo "I'm thinking of a number between 41 and 43. Guess which!" let number: int = 42 var @@ -263,11 +263,11 @@ performance, and compile-time features. ## Further Reading -* [Home Page](http://nimrod-lang.org) -* [Download](http://nimrod-lang.org/download.html) -* [Community](http://nimrod-lang.org/community.html) -* [FAQ](http://nimrod-lang.org/question.html) -* [Documentation](http://nimrod-lang.org/documentation.html) -* [Manual](http://nimrod-lang.org/manual.html) -* [Standard Library](http://nimrod-lang.org/lib.html) -* [Rosetta Code](http://rosettacode.org/wiki/Category:Nimrod) +* [Home Page](http://nim-lang.org) +* [Download](http://nim-lang.org/download.html) +* [Community](http://nim-lang.org/community.html) +* [FAQ](http://nim-lang.org/question.html) +* [Documentation](http://nim-lang.org/documentation.html) +* [Manual](http://nim-lang.org/docs/manual.html) +* [Standard Library](http://nim-lang.org/docs/lib.html) +* [Rosetta Code](http://rosettacode.org/wiki/Category:Nim) -- cgit v1.2.3 From fb903329c65a70fce2419da98842f038cd41ba82 Mon Sep 17 00:00:00 2001 From: Baurzhan Muftakhidinov Date: Mon, 18 May 2015 14:19:46 +0500 Subject: Fix copy-paste typo. --- nim.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index 2955c7bc..c9548a1c 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -155,7 +155,7 @@ var anotherArray = ["Default index", "starts at", "0"] # More data structures are available, including tables, sets, lists, queues, # and crit bit trees. -# http://http://nim-lang.org/docs/lib.html#collections-and-algorithms +# http://nim-lang.org/docs/lib.html#collections-and-algorithms # # IO and Control Flow -- cgit v1.2.3 From 087bc761d527857455e19664f4af99ae972754a5 Mon Sep 17 00:00:00 2001 From: Aayush Ranaut Date: Wed, 7 Oct 2015 21:19:50 -0400 Subject: Sugar Assert fix --- nim.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index c9548a1c..79271732 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -235,7 +235,7 @@ proc ask(question: string): Answer = else: echo("Please be clear: yes or no") proc addSugar(amount: int = 2) = # Default amount is 2, returns nothing - assert(amount > 0 or amount < 9000, "Crazy Sugar") + assert(amount > 0 and amount < 9000, "Crazy Sugar") for a in 1..amount: echo(a, " sugar...") -- cgit v1.2.3 From f3b10beb01795bf7513ec8d06c9e90ab98df7a83 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 12 Feb 2016 23:04:31 -0800 Subject: Clean up various errors --- nim.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index 79271732..4901ebfe 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -11,7 +11,7 @@ that gives the programmer power without compromises on runtime efficiency. Nim is efficient, expressive, and elegant. -```nimrod +```javascript var # Declare (and assign) variables, letter: char = 'n' # with or without type annotations lang = "N" & "im" -- cgit v1.2.3 From cae73192afb444010553e4ed9035562d477496a9 Mon Sep 17 00:00:00 2001 From: ajimu Date: Wed, 23 Mar 2016 13:50:24 -0500 Subject: [nim/en] Correct syntax highlighting The language was changed to JavaScript in [this commit](https://github.com/adambard/learnxinyminutes-docs/commit/f3b10beb01795bf7513ec8d06c9e90ab98df7a83). --- nim.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index 4901ebfe..5d00304d 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -11,7 +11,7 @@ that gives the programmer power without compromises on runtime efficiency. Nim is efficient, expressive, and elegant. -```javascript +```nim var # Declare (and assign) variables, letter: char = 'n' # with or without type annotations lang = "N" & "im" -- cgit v1.2.3 From 985d23a52b76593a120adff5381c2df3a80fe298 Mon Sep 17 00:00:00 2001 From: HairyFotr Date: Wed, 23 Aug 2017 10:14:39 +0200 Subject: Fix a bunch of typos --- nim.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index 5d00304d..07674532 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -76,7 +76,7 @@ let myDrink = drinks[2] # static typing powerful and useful. type - Name = string # A type alias gives you a new type that is interchangable + Name = string # A type alias gives you a new type that is interchangeable Age = int # with the old type but is more descriptive. Person = tuple[name: Name, age: Age] # Define data structures too. AnotherSyntax = tuple @@ -109,7 +109,7 @@ when compileBadCode: type Color = enum cRed, cBlue, cGreen - Direction = enum # Alternative formating + Direction = enum # Alternative formatting dNorth dWest dEast -- cgit v1.2.3 From 5bbb8ef6cd315e0a1d6373f878f66146ba4ef938 Mon Sep 17 00:00:00 2001 From: Keith Miyake Date: Thu, 19 Oct 2017 23:07:29 -0700 Subject: [nim/en] Add multi-line comments --- nim.html.markdown | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'nim.html.markdown') diff --git a/nim.html.markdown b/nim.html.markdown index 07674532..30dfa94f 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -12,6 +12,25 @@ that gives the programmer power without compromises on runtime efficiency. Nim is efficient, expressive, and elegant. ```nim +# Single-line comments start with a # + +#[ + Multi-line comments begin with a #[ + ... and end with ]# + +They don't care about indentation + + #[ + and they can be nested + ]# + +]# + +discard """ +This can also work as a multiline comment. +Or for unparsable, broken code +""" + var # Declare (and assign) variables, letter: char = 'n' # with or without type annotations lang = "N" & "im" @@ -35,10 +54,6 @@ when compileBadCode: # `when` is a compile time `if` discard 1 > 2 # Note: The compiler will complain if the result of an expression # is unused. `discard` bypasses this. -discard """ -This can work as a multiline comment. -Or for unparsable, broken code -""" # # Data Structures -- cgit v1.2.3