Created
February 10, 2023 04:41
-
-
Save iamkingalvarado/e35d1b6042ecef0e324ab4ecae252a0d to your computer and use it in GitHub Desktop.
Código de la Clase 4 del Curso de Programación en Android
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
package com.example.thesocialnetwork | |
/** | |
* Day 4 | |
* When, Function, if-else, cycles | |
* | |
* Program kitchen | |
*/ | |
fun main() { | |
println("Welcome to Lords") | |
println("Do you want a milkshake?") | |
// Un igual (=) es asignación | |
var answer = readLine() | |
// Dos igual (==) es COMPARACION DE IGUAL | |
if (answer == "YES" || answer == "yes") { | |
println("What flavor?") | |
val flavor = readLine() | |
milkshake(flavor!!) | |
} | |
println("Do you want a sandwich?") | |
answer = readLine() | |
if (answer == "YES") { | |
println("What protein?") | |
val protein = readLine() | |
if (protein == "Proscuitto") { | |
println("This sandwich is more expensive, do you want to confirm?") | |
val confirmation = readLine() | |
if (confirmation == "Yes") { | |
sandwich(protein) | |
} | |
} else { | |
sandwich(protein!!) | |
} | |
} | |
println("Thank you for your visit") | |
} | |
fun milkshake(fruit: String) { | |
println("Starting a milkshake") | |
println("The milkshake of $fruit is done") | |
println("----------------------------") | |
} | |
fun sandwich(protein: String) { | |
println("Starting a sandwich") | |
println("The sandwich of $protein is done") | |
println("----------------------------") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment