
-----------------------------------
Kman43759
Tue Oct 07, 2014 8:27 pm

I have a problem with my code
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?



Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




var ans, ans2, name : string
put "Please enter your name before you begin"
get name
put "Thankyou, you can now begin talking to Larrybot 1.0"
delay (2000)
put "WARNING: DO NOT USE CAPITALS WHEN TALKING TO LARRYBOT"
delay (2000)
cls
put "Hello"
get ans
loop
    if ans = "hi" then
        put "Hello ", name, " How are you today?"
        get ans2
        if ans2 = "good" then
            put "I'm glad to hear that ", name, "!"
            get ans
        else
            if ans2 = "bad" then
                put "Oh no! Dont worry ", name, " Tommorrow will be a better day!"
                get ans
            else
                if ans2 = "awesome" then
                    put "Thats great ", name, "!"
                    get ans
                end if
            end if
        end if
    end if
    if ans = "hello" then
        put "Hello ", name, " How are you today?"
        get ans2
        if ans2 = "good" then
            put "I'm glad to hear that ", name, "!"
            get ans
        else
            if ans2 = "bad" then
                put "Oh no! Dont worry ", name, " Tommorrow will be a better day!"
                get ans
            else
                if ans2 = "awesome" then
                    put "Thats great ", name, "!"
                    get ans
                end if
            end if
        end if
    end if

    if ans = "hey" then
        put "Hello ", name, " How are you today?"
        get ans2
        if ans2 = "good" then
            put "I'm glad to hear that ", name, "!"
            get ans
        else
            if ans2 = "bad" then
                put "Oh no! Dont worry ", name, " Tommorrow will be a better day!"
                get ans
            else
                if ans2 = "awesome" then
                    put "Thats great ", name, "!"
                    get ans
                end if
            end if
        end if
    end if

    if ans = "yo" then
        put "Hello ", name, " How are you today?"
        get ans2
        if ans2 = "good" then
            put "I'm glad to hear that ", name, "!"
            get ans
        else
            if ans2 = "bad" then
                put "Oh no! Dont worry ", name, " Tommorrow will be a better day!"
                get ans
            else
                if ans2 = "awesome" then
                    put "Thats great ", name, "!"
                    get ans
                end if
            end if
        end if
    end if

    if ans = "shutup" then
        put "that really hurt my feelings ", name
        get ans2
        if ans2 = "i dont care" then
            put "Yeah, well your a mean person"
            get ans
        end if
    end if
end loop






Please specify what version of Turing you are using


-----------------------------------
Kman43759
Tue Oct 07, 2014 8:35 pm

RE:I have a problem with my code
-----------------------------------
Acutally if I type shutup for ans and then I say i dont care, it will come up saying
that really hurt my feelings
that really hurt my feelings
that really hurt my feelings

-----------------------------------
Tony
Tue Oct 07, 2014 9:20 pm

RE:I have a problem with my code
-----------------------------------
Have you tried reading the documentation for [tdoc]get[/tdoc]? It has an example for getting the entire line of text.
[code]
var query : string
get query : *   % Entire line is input into query
[/code]

-----------------------------------
Kman43759
Wed Oct 08, 2014 4:14 pm

RE:I have a problem with my code
-----------------------------------
Thankyou! That really helped!
