Last active
December 14, 2015 13:18
-
-
Save bitmaybewise/5092082 to your computer and use it in GitHub Desktop.
Tipagem fraca/forte e inferência de tipo
This file contains 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
using System; | |
public class InferenciaDeTipo | |
{ | |
public static void Main(String[] args) | |
{ | |
int valor1 = 10; | |
String valor2 = "Valor"; | |
var permitido1 = 1; | |
var permitido2 = "Permitido"; | |
} | |
} |
This file contains 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
public class InferenciaDeTipo { | |
public static void main(String[] args){ | |
int valor1 = 10; | |
String valor2 = "Valor"; | |
naoPermitido = 42; | |
} | |
} |
This file contains 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
print 42.0 - " resposta pra tudo no universo " |
This file contains 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 42 + "tipagem forte" |
This file contains 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
// WTF | |
console.log(10 + true); |
This file contains 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
<?php | |
// WTF | |
echo "5 laranjas" + 10 . "\n"; | |
echo 10 + "5 laranjas" . "\n"; | |
// OK | |
echo 10 . "5 laranjas" . "\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment