Created
March 23, 2025 16:56
-
-
Save HiroNakamura/c6dc9838826edd682cb826162bd8e113 to your computer and use it in GitHub Desktop.
Más ejemplos en Ballerina
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
const MAX = 200; | |
type Bailarin record{ | |
string id?; | |
int numero; | |
boolean registrado; | |
string nombre?; | |
}; | |
# Función principal del programa. | |
public function main() { | |
io:println("\t [ Fundamentos de programación en Ballerina ]"); | |
testA(); | |
testB(); | |
} | |
public function testB(){ | |
Bailarin bailarin = {id: "1222",numero: 45,registrado: true, nombre:"Jean Pierre"}; | |
io:println("\t [ Uso de estructuras en Ballerina]"); | |
io:println("Bailarin: ",bailarin); | |
io:println("Bailarin.nombre: ",bailarin.nombre); | |
} | |
# Función para tipos simples en Ballerina. | |
public function testA(){ | |
byte bite = 11; | |
int entero = 33; | |
boolean isTrue = false; | |
string cadena = "FERROCARRIL"; | |
string caracter = cadena[4]; | |
float flotante = 89.32f; | |
io:println("\t [ Variables en Ballerina ]"); | |
io:println("Byte: ",bite); | |
io:println("Integer: ",entero); | |
io:println("Boolean: ",isTrue); | |
io:println("String: ",cadena); | |
io:println("Char: ",caracter); | |
io:println("Float: ",flotante); | |
io:println("Constante: ",MAX); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment