An Introduction to Dragon/Lessons/Getting Input

From Wikibooks, open books for an open world
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Getting Input

We can get input from the keyboard using

  • The Prompt Method


Prompt Method

Syntax:

	select "graphic"

        a = prompt("Write Something")

Example:

        select "graphic"
        select "types"

        a = int(prompt("Enter the first number : "))
        b = int(prompt("Enter the second number : "))
	 
        showln "Sum is : " + (a + b)

Output:

	Enter the first number : 3
	Enter the second number : 4
	Sum is : 7