ask function

Hi,

I was wondering if the ask function as the capability of allowing the user to edit a given text?

For example, I want to ask the user: 5+2=8?, which is incorrect, so can the user edits the answer to be 5+2=7.

If it could, what is the proper syntax?

Thanks

Comments

  • Hi,

    I think what you can do can be achieved by using a combination of the Answer and Ask commands. Below i have attached some example code which should do the trick:
    put "5 +3 = 7" into SomeSum
    answer "Does" && SomeSum with "no","yes","dont know"
    if it = "no" //It is the variable name given to the answer, in this case it will be yes or no. 
    	ask "5 + 3 = ?"
    	set the itemdelimiter to "=" //Allows you to put the answer after the equals sign 
    	put " " & it into the last item of SomeSum //Edits the answer
    	set the itemdelimiter to "," //Resets the item delimiter to the default of a comma. 
    else
    	log "User got the answer wrong and needs to learn their math"
    end if
    put SomeSum
    

    I have also attached a link which describes further how to use the Ask and Answer commands:

    http://docs.testplant.com/?q=content/other-commands-and-functions

    I hope this helps and thanks for using eggPlant.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    You may also want to try setting a default response, like this:
    ask "Please correct this:" with "5 + 2 = 8"
    
Sign In or Register to comment.