+ Reply to Thread
Results 1 to 8 of 8

Guidence on Loops

  1. #1
    Registered User
    Join Date
    01-11-2015
    Location
    COSELEY
    MS-Off Ver
    WINDOWS 8
    Posts
    57

    Guidence on Loops

    Hi all i have the below code

    Please Login or Register  to view this content.
    I AM WONDERING

    How many times does the loop body execute when word is "Mr X"?
    What value is returned by the method hideWord when word is
    "Mr X"?

    Looking for guidance on this for part of my coursework
    Not sure how i work this out?
    Thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Guidence on Loops

    How many times do you think it will go through the loop?

    It's not our policy to do homework questions for people, but we can help you through the process of understanding how it works.

    What programming language is that? It's not VBA ... hence not part of Excel.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-11-2015
    Location
    COSELEY
    MS-Off Ver
    WINDOWS 8
    Posts
    57

    Re: Guidence on Loops

    I thought it was vba. Sorry my guess is 4. As their is 4 characters in mr x? But im unsure how to work out if im on the right lines.. If you cam help I would appriciate it

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Guidence on Loops

    No, it's not VBA. No idea what it is; maybe a pseudo language for discussion purposes ... or it may just be a language I've never seen (and there are a lot). You should ask your tutor.

    My guess would be four too. There are four characters in "Mr X", so it will loop through four times ... From 1 To word.Length.

    And it will replace the blank character with "|" and the other characters with "*". So, what would the result string be?

    VBA does not use Set for text string handling, and it does not use "+" to concatenate, it uses "&".


    Regards, TMS

  5. #5
    Registered User
    Join Date
    01-11-2015
    Location
    COSELEY
    MS-Off Ver
    WINDOWS 8
    Posts
    57

    Re: Guidence on Loops

    Thanks tms - So my guess of 4 should be correct ? what value is returned by the method Hideword when the word is also Mr x ? could this be 0 ?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Guidence on Loops

    could this be 0 ?
    Why 0? What do you think the loop is doing? Read the third paragraph of my last post again.

    Regards, TMS

  7. #7
    Registered User
    Join Date
    01-11-2015
    Location
    COSELEY
    MS-Off Ver
    WINDOWS 8
    Posts
    57

    Re: Guidence on Loops

    Ok 3? ?
    I thought this would be 0 as the word has changed to hideword?
    Im confused ?

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Guidence on Loops

    No, you're replacing characters with other characters. So, look at what characters you are starting with, what you change each one to, and then see what you get.

    Clue: you're going to end up with a four character text string. What is it?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Loops within loops
    By scubadiver007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 03:28 PM
  2. VBA Loops
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2011, 06:58 AM
  3. New Spreadsheet Guidence
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-29-2008, 08:16 AM
  4. Loops
    By David in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2006, 07:00 PM

Bookmarks

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 Friendly URLs by vBSEO 3.6.0 RC 1