SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Join Date
    Apr 2002
    Location
    fremont, CA, USA
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    [QUOTE]Originally posted by TonyM:
    remove the 'int i' line. [/QUOTE

    Hi TonyM,
    Thanks for the quick response. ; Actually removing the "int i " had no effect; I had tried that, I was not getting an error for that line of the code.
    I removed the parenthesis for the Print and the error for the Print went away; I stll get an error for the "for each" statement. Any idea where may be the mistake. The new code is given below.

    Thanks,
    Sbabuts

    [-] LIST OF STRING lsFruit = {...}
    [ ] "APPLE"
    [ ] "PEACH"
    [ ] PRINT (lsFruit)
    [ ] STRING sFruit
    [-] for each sFruit in lsFruit
    [ ] Print sFruit

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    Change this:

    Print sFruit

    to:

    Print (sFruit)


    John

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Location
    fremont, CA, USA
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    Originally posted by John J. Miller:
    Change this:

    Print sFruit

    to:

    Print (sFruit)


    John
    <font size="2" face="Verdana, Arial, Helvetica">===============

    HI John,
    Thanks for the response; but that does not work; see my code in the first message in the original problem description; I had Print (sFruit) in that code and that was giving me the error; My real problem is with the "for each" statement; I am getting syntax error for it ?; I do not understand why a code taken from the example given by SILK test is having syntax error.
    Any help is highly appreciated.

    Thanks,
    Sbabuts

  4. #4
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    place your code in between </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> and </pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">so we can see correct formatting.
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  5. #5
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    whoops. What I mean is place your code in between '['code']' and '['/code']' minus the single quotes so we can see proper formatting.
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    Originally posted by sbabuts:
    ...but that does not work
    <font size="2" face="Verdana, Arial, Helvetica">Sure it does... [img]images/icons/smile.gif[/img]

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] main ()
    [-] LIST OF STRING lsFruit = {...}
    [ ] &quot;APPLE&quot;
    [ ] &quot;PEACH&quot;
    [ ] PRINT (lsFruit)
    [ ] STRING sFruit
    [ ] print (lsFruit)
    [-] for each sFruit in lsFruit
    [ ] Print (sFruit)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">John

  7. #7
    Member
    Join Date
    Oct 2003
    Location
    El Granada, CA
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    Doublecheck your indentation...it could be nested inside the List of string, so that's why you're getting the compile error...when I taught for Segue, this was the most common error new users had...not indenting and out-denting(?) properly.

    A good rule when creating loops and branches is to add an extra line beneath the line your typing, and the out-dent will be automatic after the loop ends...
    kind of like this:
    testcase MyTest()
    &lt;&gt;//code
    &lt;&gt;//code
    &lt;&gt;//code
    &lt;&gt; for each blah blah blah
    (tabbed)&lt;&gt;//code
    &lt;&gt;(not tabbed)
    &lt;&gt;//code


    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">It should look like this:
    [-] testcase good_ForEachLoop() appstate none
    [-] LIST OF STRING ls = &lt;text&gt;
    [ ] one
    [ ] two
    [ ] three
    [ ] four
    [ ] STRING s
    [-] for each s in ls
    [ ] print (s)
    not like this:
    [-] testcase bad_ForEachLoop() appstate none
    [-] LIST OF STRING ls = {...}
    [ ] one
    [ ] two
    [ ] three
    [ ] four
    [ ] STRING s
    [-] for each s in ls
    [ ] print (s)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">
    Sean McCabe

  8. #8
    Junior Member
    Join Date
    Apr 2002
    Location
    fremont, CA, USA
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    HI John,
    Thanks a lot; it is working now, I could take your code and paste it in my editor.; looks like I had a problem with the PRINT
    --Sbabuts


    Originally posted by John J. Miller:
    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">quote:</font><hr /><font size="2" face="Verdana, Arial, Helvetica">Originally posted by sbabuts:
    ...but that does not work
    <font size="2" face="Verdana, Arial, Helvetica">Sure it does... [img]images/icons/smile.gif[/img]

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] main ()
    [-] LIST OF STRING lsFruit = {...}
    [ ] &quot;APPLE&quot;
    [ ] &quot;PEACH&quot;
    [ ] PRINT (lsFruit)
    [ ] STRING sFruit
    [ ] print (lsFruit)
    [-] for each sFruit in lsFruit
    [ ] Print (sFruit)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">John
    </font><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">

  9. #9
    Junior Member
    Join Date
    Apr 2002
    Location
    fremont, CA, USA
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem with "for each" statement

    Hi sean_mccabe,
    Thanks a lot for your response; sorry I was away from my test bench for a while, hence the delay in responding.

    I did try the code and now it is working;
    This board has been very helpful, I appreciate it.

    Thanks,
    sbabuts
    ++++++++++++++++++++++++++++++++++

    Originally posted by sean_mccabe:
    Doublecheck your indentation...it could be nested inside the List of string, so that's why you're getting the compile error...when I taught for Segue, this was the most common error new users had...not indenting and out-denting(?) properly.

    A good rule when creating loops and branches is to add an extra line beneath the line your typing, and the out-dent will be automatic after the loop ends...
    kind of like this:
    testcase MyTest()
    &lt;&gt;//code
    &lt;&gt;//code
    &lt;&gt;//code
    &lt;&gt; for each blah blah blah
    (tabbed)&lt;&gt;//code
    &lt;&gt;(not tabbed)
    &lt;&gt;//code


    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">It should look like this:
    [-] testcase good_ForEachLoop() appstate none
    [-] LIST OF STRING ls = &lt;text&gt;
    [ ] one
    [ ] two
    [ ] three
    [ ] four
    [ ] STRING s
    [-] for each s in ls
    [ ] print (s)
    not like this:
    [-] testcase bad_ForEachLoop() appstate none
    [-] LIST OF STRING ls = {...}
    [ ] one
    [ ] two
    [ ] three
    [ ] four
    [ ] STRING s
    [-] for each s in ls
    [ ] print (s)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">
    <font size="2" face="Verdana, Arial, Helvetica">

  10. #10
    Junior Member
    Join Date
    Apr 2002
    Location
    fremont, CA, USA
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    problem with "for each" statement

    I am trying to use the "for each" statement from SILK 6.5; some how I am not able to proceed with it; I mean to say I am getting the Scripting errors whtever way I format the code. Any one used the "for each " Please help me.

    Let me put the code below:- This code is taken from SILK help example:- I am getting scripting error as indicated by the RED cross marks at left side of the SILK test editor. The red crosses appear at the left side for the "for each" statement and the "Print" statement below the for each.
    +++++++++++++++++++
    [-] LIST OF STRING lsFruit = {...}
    [ ] "APPLE"
    [ ] "PEACH"
    [ ] PRINT (lsFruit)
    [ ] STRING sFruit
    [-] for each sFruit in lsFruit
    [ ] int i
    [ ] Print (sFruit)

    +++++++++++++++++++++++++++

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:26 AM.

Copyright BetaSoft Inc.