Computer Science Canada Dividing strings over multiple lines? |
Author: | fiercedeity [ Tue Nov 01, 2016 12:24 pm ] |
Post subject: | Dividing strings over multiple lines? |
Hello! I'm just wondering, because I have been able to find anything online, and I wanted to ask the programming world specifically, before giving up: Is there any way to divide strings over multiple lines in the code itself? I've been trying to tidy up the code of a game I've been working on, and I've realized that long equations and "Draw" statements can be divided ... well pretty much wherever in the line, but is there a way to divide a line such as: text := "Hi. This is a really long string, and I want it to be divided so I'm not spanning the entire width of the screen while other lines of code only span a little bit of it." I'm making a game with lots of dialogue and assigning text to variables is the best way (and the only way, I guess) to use the text using the Font.Draw procedure. I know I can do the following: text := "Hi. This is a really long string," text := text + "and I want it to be divided" ... but that just seems pointless, kinda redundant, and more messy than just letting the text span the whole window's width. So if there's something I can do that I've just simply not realized, then it would be great to know! If not, well it would be cool if there was a way. Anyhow, thanks for the replies. |
Author: | Insectoid [ Wed Nov 02, 2016 10:21 am ] | ||
Post subject: | RE:Dividing strings over multiple lines? | ||
The following will work:
Alternatively, OpenTuring will automatically word wrap for you, with no changes to your code. |
Author: | fiercedeity [ Wed Nov 02, 2016 10:27 am ] |
Post subject: | Re: Dividing strings over multiple lines? |
Ohhhhh ... Thank you! What a wonderful aha moment you just gave me. That works perfectly, thanks! |