Mercurial > projects > ldc
comparison tests/mini/bug73.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/bug73.d@8096ba7082db |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 int find(char[] s, dchar c) | |
2 { | |
3 // c is a universal character | |
4 foreach (int i, dchar c2; s) | |
5 { | |
6 if (c == c2) | |
7 return i; | |
8 } | |
9 return -1; | |
10 } | |
11 | |
12 void main() | |
13 { | |
14 char[] hello = "hello world"; | |
15 int i = find(hello, 'w'); | |
16 assert(i == 6); | |
17 i = find(hello, 'z'); | |
18 assert(i == -1); | |
19 } |