Last active
October 12, 2020 21:40
-
-
Save yaf/6cea8b4089e9fb355d2bcf20a1893560 to your computer and use it in GitHub Desktop.
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
begin | |
phrase("Henri") | |
rescue | |
puts "erreur, la fonction phrase() n'existe pas encore" | |
end | |
require "./une_lib" | |
puts "Hello depuis le fichier executé : hello.rb" | |
phrase("Henri") |
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
puts "Coucou depuis une lib où on va définir une fonction qui renvoie une phrase" | |
def phrase(nom) | |
"Bonjour #{nom}, comment vas-tu ?" | |
end |
En modifiant nom
en "nom"
, ca donne ça :
➜ hello crystal hello.rb
Coucou depuis une lib où on va définir une fonction qui renvoie une phrase
Hello depuis le fichier executé : hello.rb
En Ruby par contre :
➜ hello ruby hello.rb
erreur, la fonction phrase() n'existe pas encore
Coucou depuis une lib où on va définir une fonction qui renvoie une phrase
Hello depuis le fichier executé : hello.rb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
En Crystal, ca donne ce résultat :