1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-01 20:40:42 +02:00

Fix Nim a bit

This commit is contained in:
def
2015-03-01 15:28:37 +01:00
parent 0bcc9c4891
commit ccca29377a

View File

@@ -3,14 +3,15 @@ language: Nim
filename: learnNim.nim filename: learnNim.nim
contributors: contributors:
- ["Jason J. Ayala P.", "http://JasonAyala.com"] - ["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. that gives the programmer power without compromises on runtime efficiency.
Nim is efficient, expressive, and elegant. Nim is efficient, expressive, and elegant.
```ruby ```nimrod
var # Declare (and assign) variables, var # Declare (and assign) variables,
letter: char = 'n' # with or without type annotations letter: char = 'n' # with or without type annotations
lang = "N" & "im" lang = "N" & "im"
@@ -60,6 +61,13 @@ var
drinks = @["Water", "Juice", "Chocolate"] # @[V1,..,Vn] is the sequence literal 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 # Defining Types
# #