How to print a _variable in CAPITALS

+1 vote
asked Aug 10 by Charlie (620 points)
<<set _colour to "red">>

Is there a simple way to make the browser display: RED

2 Answers

+1 vote
answered Aug 10 by Akjosch (3,560 points)
selected Aug 10 by Charlie
Best answer

Using standard JavaScript methods:

<<- _colour.toUpperCase()>>

Or if you'd rather prefer lodash, which deals with undefined or not-real-string variables nicely:

<<- _.toUpper(_colour)>>


+1 vote
answered Aug 10 by Chapel (17,920 points)

You can use the toUpperCase() method: 

<<print _colour.toUpperCase()>>

Edit: Whoops, didn't see that @Akjosch beat me to it. 

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.