Computer Studies‎ > ‎Turing‎ > ‎Turing Tutorial‎ > ‎

Turing 026 — Character Variables

Often we do not want to use a variable that is only used for a single character. The Turing "char" variable is used for this.

A char variable is declared as follows:

var ch : char

To input a character from the keyboard, use the following syntax:

var ch : char
put "enter character: " ..
ch := getchar
put ch

Assignment

Write a program that loops indefinitely until 'q' is entered. Output a friendly message once 'q' is entered.

Save as 026.t
Comments