Questionnaire: Create a questionnaire to ask respondents to provide feedback on a topic of your choice. For example, you might poll their favorite color or their height. Note: to avoid spelling mistakes, it can simplify things to provide users a list to choose from, and then have them entere the number corresponding to their choice. You should record answers to a file that you update with each new response. In order to have an accurate count, you will need to first read the file, update your records, then save the new values that have been incremented.
To facilitate gathering user input, consider using the Pencil Code read
or readnum
functions (the latter automatically converts number input from type String to type Number). Note that these user-input functions function asyncronously. As with other asynchronous functions, combine them with await
/defer
to simplify their use. Look in the Text
tab in the Pencil Code editor's coding blocks palette for the correct syntax.