Documents idetools skLabel with failure test case.
This commit is contained in:
parent
4ed44fc634
commit
383d047763
3 changed files with 34 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue