print a riddle for the user to solve in swift

To print a riddle for the user to solve in Swift, you can use string interpolation to construct the riddle as a string and then print it to the console. Here is an example:

main.swift
let riddle = "I am always hungry,\nI must always be fed.\nThe finger I touch,\nWill soon turn red.\n\nWhat am I?"
print(riddle)
128 chars
3 lines

This code defines a string variable riddle that contains the text of the riddle, including line breaks \n. It then uses the print function to print the riddle to the console.

The output of this code will be:

main.swift
I am always hungry,
I must always be fed.
The finger I touch,
Will soon turn red.

What am I?
94 chars
7 lines

You can modify the riddle text to create your own riddles to challenge your users.

gistlibby LogSnag