Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlphonse Cuccurullo
2,513 PointsSo here's my syntax problem
def chosen() print " Lets find the chosen name!" puts " Please enter your name" name = gets.chomp if name.length < 8 puts" I am sorry but the character amount in your name is too low not the chosen name" elsif name.length > 8 puts " (MODERATOR edit) *** you way to high" elsif name == "alphonse" puts"You are the chosen one" else puts " You found the digit amount but its not the right name." end end
def guess() print"Guess a letter " letter = gets.chomp until letter.length == 4 if letter.include?("a") puts "That letter is in the name guess another? Please hit (exit) if your donw guessing " else puts "Im sorry, Wrong letter guess again? Please hit (exit) if you have finished guessing. " break letter == "exit " end end end
chosen() guess()
Im trying to cross these functions over to make it so when i type the wrong name then the second function will have me guess letters and keep asking me until i hit exit. I used the until loop however it doesnt break when i want it to i want it to keep asking. now what im also wonder is how can i combine these functions?
Houston Erekson
10,542 PointsHouston Erekson
10,542 PointsPlease us the markdown cheatsheet to add your codeblock into the question https://teamtreehouse.com/community/cheatsheet