summaryrefslogtreecommitdiffhomepage
path: root/nim.html.markdown
diff options
context:
space:
mode:
authorJasonJAyalaP <jason@jasonayala.com>2014-09-19 20:00:13 -0500
committerJasonJAyalaP <jason@jasonayala.com>2014-09-19 20:00:13 -0500
commit4595c7e3ed55b10b449e817657f3647f51e5a501 (patch)
tree067a283f333de1c2d39a728223020a57c8c957f0 /nim.html.markdown
parente0c71555d9f521480c44df2da58334bdacb7cdc9 (diff)
Removed common operations, explained continue
Diffstat (limited to 'nim.html.markdown')
-rw-r--r--nim.html.markdown17
1 files changed, 3 insertions, 14 deletions
diff --git a/nim.html.markdown b/nim.html.markdown
index 48a24834..f22d0365 100644
--- a/nim.html.markdown
+++ b/nim.html.markdown
@@ -42,17 +42,6 @@ Or for unparsable, broken code
"""
#
-# Common Operations on Basic Types
-#
-
-# Strings
-let
- phrase = "Nim is a"
- nim = phrase[0..5]
- fullPhrase = phrase & "programming language."
- length = len(fullPhrase) # Or: fullPhrase.len
-
-#
# Data Structures
#
@@ -218,8 +207,8 @@ for line in splitLines(myString):
echo(line)
for i, c in myString: # Index and letter. Or `for j in` for just letter
- if i mod 2 == 0: continue # Compact `if` form
- elif c == 'X': break
+ if i mod 2 == 0: continue # Skip rest of iteration
+ elif c == 'X': break # Compact `if` form
else: echo(c)
#
# Procedures
@@ -259,7 +248,7 @@ proc pluralize(a: int): string =
#
# Because Nim compiles to C, FFI is easy:
-
+#
proc strcmp(a, b: cstring): cint {.importc: "strcmp", nodecl.}
var cmp = strcmp("C?", "Easy!")