Programmeren in Small Basic: verschil tussen versies

825 bytes toegevoegd ,  10 jaar geleden
Pagina verder afmaken
(De pagina SmallBasic toevoegen)
 
(Pagina verder afmaken)
<syntaxhighlight lang="vbnet">
TextWindow.Write("Hello World")
</syntaxhighlight>
of:
<syntaxhighlight lang="vbnet">
TextWindow.WriteLine("Hello World")
</syntaxhighlight>
Het eerste programma is anders dan het tweede programma, het tweede programma print 'Hello World' op een nieuwe regel. De eerste doet dat niet.
De eerste BASIC talen (waaronder QBasic) hebben een simpelere Syntax:
<syntaxhighlight lang="vbnet">
print "Hello World"
</syntaxhighlight>
SmallBasic is ook Turing Compleet.
===Conditional Branching===
<syntaxhighlight lang="vbnet">
TextWindow.Write("Enter the temperature today (in F): ")
temp = TextWindow.ReadNumber()
If temp > 100 Then
TextWindow.WriteLine("It is pretty hot.")
ElseIf temp > 70 Then
TextWindow.WriteLine("It is pretty nice.")
ElseIf temp > 50 Then
TextWindow.WriteLine("Don't forget your coat.")
Else
TextWindow.WriteLine("Stay home.")
EndIf
</syntaxhighlight>
5

bewerkingen

Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.