Displaying an Array

Hi,

I am currently just playing around trying to be more fluent in xojo and I’ve come across a question. How do you display an array’s contents into a text area, or text field?

Dim quote As string = quoteArea.text
Dim whaleText As text
Dim whaleResult() as text

whaleResult = varType(translateQuote(quote))

whaleText = text.Join(whaleResult, " ")

whaleArea.text = whaleText 

translateQuote is a function that would append an array(this array contains the new text in whale language) . I am trying to display the new array of ‘whale’ letters to a text area but can’t. Any ideas?

You probably shouldn’t mix text and string. I’ve made your code a bit shorter:

dim quote as String = quoteArea.text dim whaleResult(-1) as string = translateQuote(quote) WhaleArea.text = join(WhaleResult, " ")

Now you need to check with the debugger what’s in whaleResult.

This is the code inside the translateQuote function

[code]
Redim whaley(-1)
vowels() = Array(“a”, “e”, “i”, “o”, “u”)
Dim i As integer

quoteArray = quote.Split("")

For i=0 To quoteArray.Ubound
For i=0 To vowels.Ubound
if quoteArray(i) = vowels(i) then
if quoteArray(i) = “e” then
whaley.Append(“ee”)
elseif quoteArray(i) = “u” then
whaley.Append(“uu”)
else
whaley.Append(vowels(i))
end if
end if
next
return whaley
next[/code]
I’m having trouble debugging because I’m still quite new to coding. Please help me

The function makes no sense at all. The counter in the nested for cant be the same as the first one. The first for is allways going to exit after the first iteration. Not really clear whay you intend, but it lloks like you should have a SELECT instead of the second for. ETC.

It does not make sense to ask for a solution if you do not understand the basic concepts of coding. It is better to learn the basics of language and then ask more specific questions.

https://documentation.xojo.com/getting_started/introduction/welcome!.html

https://documentation.xojo.com/index.php/

Thanks for the tip @Ivan Tellez and @Beatrix Willius . I accidently mixed up some javascript concepts with Xojo’s. I appreciate the advice. How may I practise the basics to be more fluent in Xojo?

You practise the same as for everything else. You try, you embarrass yourself, you try again :slight_smile:

Start with the resources I recomended, after that you can open and play with the examples included in Xojo.