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
//A função não possui nome, mas está sendo atribuida à uma variável, | |
//por meio dessa variável podemos utilizar a função. | |
let funcSoma = function (x, y) { return x + y; } | |
let total = funcSoma(2, 3); | |
console.log(total); | |
//Nesse exemplo, nossa função anonima irá receber outra função como parametro. | |
let minhaFuncao = function (mensagem, funcao) { | |
let resultado = funcao(); | |
let saida = `${mensagem}: ${resultado}`; |
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 Program | |
{ | |
public delegate int Calculo(int x, int y); | |
public static void Main(string[] args) | |
{ | |
Calculo soma = delegate (int x, int y) | |
{ | |
return x + y; | |
}; | |
Calculo subtrair = delegate (int x, int y) |
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 tradicional | |
public int Soma(int x, int y) | |
{ | |
return x + y; | |
} | |
//declaração com arrow func | |
public int Soma(int x, int y) => x + y; |
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 tradicional | |
function Soma(x, y) { | |
return x + y; | |
} | |
//declaração com arrow func | |
let soma = (x, y) => x + y; |
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
string nome = "James"; | |
string saudacao = "Olá " + Nome; //Erro |
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
function ObterDadosCliente() | |
{ | |
let nome = "James"; | |
function ObterEndereco() | |
{ | |
return "Rua Washington, 14"; | |
} | |
return `Olá ${nome} seu endereço atual é ${ObterEndereco()}`; |
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
int factorial(int num); | |
int main() | |
{ | |
int result, number; | |
result = factorial(number); | |
} | |
int factorial(int num) | |
{ |
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 string ObterDadosCliente() | |
{ | |
string nome = "James"; | |
return nome; | |
} | |
public string ObterEndereco() | |
{ | |
string endereco = "Rua Washington, 14"; | |
return $"Olá {nome} você reside em {endereco}"; //erro. |
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; | |
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
ConcreteMediator mediator = new ConcreteMediator(); | |
ConcreteColleague1 colleague1 = new ConcreteColleague1(mediator); |
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; | |
namespace MediatorConsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
ConcreteMediator mediator = new ConcreteMediator(); | |
ConcreteColleague1 colleague1 = new ConcreteColleague1(mediator); |