How to resolve the algorithm Conditional structures step by step in the Yabasic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Conditional structures step by step in the Yabasic programming language
Table of Contents
Problem Statement
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions. Common conditional structures include if-then-else and switch. Less common are arithmetic if, ternary operator and Hash-based conditionals. Arithmetic if allows tight control over computed gotos, which optimizers have a hard time to figure out.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Conditional structures step by step in the Yabasic programming language
Source code in the yabasic programming language
// if-then-endif, switch / end switch
// on gosub, on goto
// repeat / until, do / loop, while / end while
if expr_booleana then
sentencia(s)
endif
if expr_booleana sentencia(s)
if expr_booleana1 then
sentencia(s)
elsif expr_booleana2
sentencia(s)
elsif expr_booleana3 then
sentencia(s)
else
sentencia(s)
endif
switch expr_booleana
case valor1
sentencia(s)
case valor2
sentencia(s)
default
sentencia(s)
end switch
on expresion gosub label1, label2
sentencia(s)
label label1
sentencia(s)
return
label label2
sentencia(s)
return
on expresion goto label1, label2
sentencia(s)
label label1
sentencia(s)
label label2
sentencia(s)
repeat
sentencia(s)
until valor1
do
sentencia(s)
loop
while expr_booleana
sentencia(s)
end while
You may also check:How to resolve the algorithm Mutual recursion step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Wordle comparison step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm Canny edge detector step by step in the Nim programming language
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the V programming language
You may also check:How to resolve the algorithm User input/Text step by step in the Pascal programming language