-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path527.html
More file actions
132 lines (132 loc) · 9.13 KB
/
Copy path527.html
File metadata and controls
132 lines (132 loc) · 9.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SmallBASIC | INPUT</title>
<meta name="description" content="Reads from \"keyboard\" text and stores it in a variable.">
<link rel="canonical" href="527">
<link rel="keywords" href="INPUT [prompt,|;] var[, var [, ...]]">
<link rel="stylesheet" href="/css/style.css">
<link rel="icon" type="image/png" href="/images/sb-desktop-32x32.png">
<script src="/clipboard.js"></script>
</head>
<body>
<button onclick="topFunction()" id="BackToTopBtn" title="Go to top">⯅</button>
<script src="/backtotop.js"></script>
<div class="wrapAll clearfix">
<nav class="navigation">
<div class="logo">
<a href="/"><img src='/images/sb-logo.png?v=2' alt="logo"></a>
</div>
<div class="navlinks">
<a href="/pages/download.html">Download</a>
<a href="/pages/news.html">News</a>
<a href="/pages/community.html">Community</a>
<a href="/pages/articles.html">Resources</a>
<a class='active' href="/pages/reference.html">Language Reference</a>
<a href="/pages/guide.html">SmallBASIC Manual</a>
</div>
</nav>
<div class="mainsection">
<div class="tabs clearfix">
<div class="tabsRight">
<a target="_github" href="https://github.com/smallbasic/smallbasic.github.io/blob/master/_build/reference/527-console-input.markdown">Edit</a>
<a target="_github" href="https://github.com/smallbasic/smallbasic.github.io/commits/master/_build/reference/527-console-input.markdown">History</a>
</div>
</div>
<div class="article">
<h1>INPUT</h1>
<blockquote>INPUT [prompt,|;] var[, var [, …]]</blockquote>
<div class="siteSub">
<p>
<a href="/">Home</a> >
<a href="/pages/reference.html">Reference</a> >
<a href="/pages/console.html">Console</a>
</p>
</div>
<p>Reads text from keyboard and stores it in the variable
<code>var</code>. The string <code>prompt</code> is printed on the
screen. If <code>prompt</code> is followed by a <code>;</code>, a
question mark and a space are printed additionally. If you want to input
two or more variables, the input needs to be separated with
<code>,</code>.</p>
<h3 id="example-1-using-a-single-var">Example 1: Using a single var</h3>
<div class="sourceCode" id="cb1"><pre
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="kw">input</span> <span class="st">"How old are you?"</span>, age</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> age</span></code></pre></div>
<h3 id="example-2-using-multiple-vars">Example 2: Using multiple
vars</h3>
<div class="sourceCode" id="cb2"><pre
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">input</span> <span class="st">"Input three numbers: "</span>, a, b, c <span class="co">' Input i.e. 1,2,3</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> a, b, c</span></code></pre></div>
<div class="lavenderBox">
<div class="header">Code samples using INPUT</div>
<div class="linklist">
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/002 numeric variables.bas">002 numeric variables.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/004 loops.bas">004 loops.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/005 challenge.bas">005 challenge.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/006 arrays+.bas">006 arrays+.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 1/3d_palmx.bas">3d_palmx.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/3dtictac.bas">3dtictac.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/3dttt.bas">3dttt.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/mobile/3dttt.bas">3dttt.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/4tune.bas">4tune.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/7gables.bas">7gables.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/utilities/agendus.bas">agendus.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/ai.bas">ai.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/mechanics/amortig.bas">amortig.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/anball 1.0.bas">anball 1.0.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/network/anomail.bas">anomail.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/mathematics/bairstow.bas">bairstow.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/misc/Misc Bpf/Balleta 2-11-15.bas">Balleta 2-11-15.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/misc/Misc Bpf/BAS_NOW.bas">BAS_NOW.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/misc/Misc Bpf/BAS_NOWv2.bas">BAS_NOWv2.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/units/base64.bas">base64.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 1/biorythms.bas">biorythms.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/blackbox.bas">blackbox.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/Blackbox.bas">Blackbox.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/blackjack.bas">blackjack.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/BlackJack.bas">BlackJack.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 4/block.bas">block.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 1/bmpreal.bas">bmpreal.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/bolmo.bas">bolmo.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 4/bowling7.bas">bowling7.bas </a>
</div>
</div>
<div class="lavenderBox">
<div class="header">Console</div>
<div class="linklist">
<a href="/reference/521.html">AT </a>
<a href="/reference/522.html">BEEP </a>
<a href="/reference/538.html">CAT </a>
<a href="/reference/524.html">CLS </a>
<a href="/reference/1015.html">DEFINEKEY </a>
<a href="/reference/525.html">FORM </a>
<a href="/reference/539.html">INKEY </a>
<a href="/reference/527.html"><strong>INPUT</strong> </a>
<a href="/reference/528.html">LINEINPUT </a>
<a href="/reference/529.html">LINPUT </a>
<a href="/reference/530.html">LOCATE </a>
<a href="/reference/531.html">LOGPRINT </a>
<a href="/reference/532.html">NOSOUND </a>
<a href="/reference/533.html">PEN </a>
<a href="/reference/534.html">PLAY </a>
<a href="/reference/535.html">PRINT </a>
<a href="/reference/536.html">SOUND </a>
<a href="/reference/540.html">TAB </a>
</div>
</div>
</div>
<div class="pagefooter">
This page was last edited on Mon, 19 May 2025 20:44:43 +0930
|
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
processed with
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.1.12.1</a>
</div>
</div>
</div>
</body>
</html>