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
| using System; | |
| namespace NadaDeIfs | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| IFuncionario funcionario = new Funcionario(); | |
| AplicarBonus(funcionario); |
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
| Sub InitializeMatrix(Var1, Var2, Var3, Var4) | |
| On Error GoTo ErrorHandler | |
| ' algum codigo aqui | |
| Exit Sub | |
| ErrorHandler: |
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
| var | |
| saldo, indice : Integer; | |
| begin | |
| try | |
| indice := 0; | |
| saldo := 1; | |
| saldo := saldo div indice; | |
| ShowMessage('1 / 0 = ' + IntToStr(saldo)); |
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
| public void openFile(){ | |
| try { | |
| FileReader reader = new FileReader("arquivo.txt"); | |
| int i=0; | |
| while(i != -1){ | |
| i = reader.read(); | |
| System.out.println((char) i ); | |
| } | |
| reader.close(); | |
| System.out.println("-> EOF"); |
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
| tarifacao = File.open(arquivo, "w") | |
| begin | |
| # excecoes serao capturadas apos o 'begin' | |
| while data = socket.read(512) | |
| tarifacao.write(data) | |
| end | |
| # Trata alguma excecao | |
| rescue SystemCallError |
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
| procedure TForm1.FormCreate(Sender: TObject); | |
| var | |
| Buffer : Pointer; | |
| begin | |
| Buffer := AllocMem(1024); | |
| try | |
| { Codigo que pode gerar uma excecao } | |
| finally | |
| FreeMem(Buffer); | |
| end; |
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
| try | |
| { | |
| // codigo que pode gerar uma exception | |
| } | |
| catch(Exception ex) | |
| { | |
| Logger.Log(ex); | |
| } |
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
| try { | |
| // codigo que pode gerar IOException | |
| } | |
| catch (FileNotFoundException e){ | |
| // tratamento | |
| } | |
| catch (IOException e){ | |
| // tratamento | |
| } |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Load</title> | |
| <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script> | |
| </head> | |
| <body> | |
| <b>Response:</b> | |
| <div id="success"></div> | |
| <br /> |
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
| // Menos elegante?!? | |
| private static void Main(string[] args) | |
| { | |
| Func<int, int> fiveTimes = v => v*5; | |
| Func<int, int> halfOf = v => v/2; | |
| Func<int, int> halfOfFiveTimes = v => halfOf(fiveTimes(v)); | |
| Console.WriteLine(halfOfFiveTimes(6)); | |
| } |
OlderNewer