summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chapter17/README.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/chapter17/README.md b/chapter17/README.md
index f6216398..e0c8d6d9 100644
--- a/chapter17/README.md
+++ b/chapter17/README.md
@@ -134,3 +134,18 @@ for( int i=0; i<arg; i++ )
return i; // ERROR: Undefined name 'i'
```
+A broken `find` call:
+```cpp
+for( int i=0; i<ary#; i++ )
+ if( ary[i]==e )
+ break;
+do_stuff(i); // ERROR: undefined name 'i'
+```
+
+An example `find` call:
+```cpp
+for( int i=0; i<ary#; i++ )
+ if( ary[i]==e )
+ return i;
+return -1;
+```