Created
August 5, 2013 20:36
-
-
Save marciojrtorres/6159385 to your computer and use it in GitHub Desktop.
Na linguagem C# as variáveis tem os tipos pré-definidos, uma característica da tipagem estática
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
// declaração da variável | |
int num = 32; | |
// ok, a variável num é do tipo inteiro e tem o valor 32 | |
// atribuição de valor à variável: | |
num = 98; | |
// ok, a variável tem o valor 98 | |
num = 54.23; | |
// erro! 54.23 não é um número inteiro, então não pode ter esse valor | |
num = "texto"; | |
// erro! strings não são aceitas em variáveis do tipo inteiro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment