diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-07-06 19:42:36 +0200 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-07-06 19:42:36 +0200 |
commit | 383d047763a4ef336fca7e299dd36d0c71a29d58 (patch) | |
tree | edec37cd7e597a5b64695510a4e2f5f265d61f7a /tests/caas/idetools_api.nim | |
parent | 4ed44fc6348cc09a8c809a76b6f21a456fa0d0c7 (diff) | |
download | Nim-383d047763a4ef336fca7e299dd36d0c71a29d58.tar.gz |
Documents idetools skLabel with failure test case.
Diffstat (limited to 'tests/caas/idetools_api.nim')
-rw-r--r-- | tests/caas/idetools_api.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/caas/idetools_api.nim b/tests/caas/idetools_api.nim index 6327f4c22..351ec0583 100644 --- a/tests/caas/idetools_api.nim +++ b/tests/caas/idetools_api.nim @@ -41,3 +41,15 @@ proc newLit(x: int): PLiteral = PLiteral(x: x) proc newPlus(a, b: PExpr): PPlusExpr = PPlusExpr(a: a, b: b) echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4))) + +proc findVowelPosition(text: string) = + var found = -1 + block loops: + for i, letter in pairs(text): + for j in ['a', 'e', 'i', 'o', 'u']: + if letter == j: + found = i + break loops # leave both for-loops + echo found + +findVowelPosition("Zerg") # should output 1, position of vowel. |