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; | |
[Serializable] | |
public struct Score { | |
public string Name; | |
public int LevelCompleted; | |
public int Time; | |
public DateTime Date; | |
public bool Current; |
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 UnityEngine; | |
using UnityEngine.SceneManagement; | |
using GoogleMobileAds.Api; | |
using System; | |
public class AdManager : MonoBehaviour { | |
private InterstitialAd interstitial; | |
public void PrepareAd() |
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 UnityEngine; | |
using UnityStandardAssets.CrossPlatformInput; | |
public class CharacterBehavior : MonoBehaviour { | |
/// <summary> | |
/// Vitesse de déplacement du personnage | |
/// </summary> | |
public float speed = 2.0f; | |
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 literal type | |
type Role = | |
| "Capitaine" | |
| "Matrose" | |
| "Charpentier" | |
// Create a list | |
const crew: { name: string; role: Role }[] = [ | |
{ name: "Jack", role: "Capitaine" }, | |
{ name: "Barbossa", role: "Matrose" }, |
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
<template> | |
<v-form class="d-flex flex-column px-2" @submit.prevent="validate"> | |
<v-text-field | |
outlined | |
v-model="amountTotal" | |
label="Prix TTC" | |
type="number" | |
:rules="[() => amountTotal >= 0 || 'Le champ ne peut pas être négatif']" | |
></v-text-field> | |
<v-text-field |
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
const acceptedAmmunition = [ | |
"boulet", | |
"chaîne", | |
"couverts", | |
"boulet enflammé", | |
"pot de poudre à canon", | |
] as const | |
if (acceptedAmmunition.includes(ammunitionType)) { | |
// Do something |
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
// 🔍 Fonction concat() : | |
const arr1: number[] = [1, 2]; | |
const arr2: number[] = [3, 4]; | |
const result = arr1.concat(arr2); | |
// 👉 Résultat : [1, 2, 3, 4] | |
// 🔍 Fonction filter() : | |
const numbers: number[] = [1, 2, 3, 4, 5]; | |
const evenNumbers = numbers.filter(num => num % 2 === 0); | |
// 👉 Résultat : [2, 4] |
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
// 🔍 Créer un nouvel ensemble (Set) | |
const mySet = new Set(); | |
// 👉 Résultat : Set {} | |
// 🔍 Ajouter des éléments à l'ensemble | |
mySet.add('🍎'); | |
mySet.add('🍌'); | |
mySet.add('🍊').add('🥑').add('🥝'); | |
// 👉 Résultat : Set { '🍎', '🍌', '🍊', '🥑', '🥝' } |
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
// 🔍 Test basique avec expect().toBe() | |
test('Vérifier si deux nombres sont égaux', () => { | |
const a = 10; | |
const b = 10; | |
// 👉 Résultat attendu : true | |
expect(a).toBe(b); | |
}); | |
// 🔍 Test avec expect().not.toBe() | |
test('Vérifier si deux nombres sont différents', () => { |
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
// 🔍 Fonctions de Parsing en TypeScript | |
// 🔍 parseInt() : Convertir une chaîne de caractères en un entier | |
const numString: string = '42'; | |
const parsedInt: number = parseInt(numString); | |
// 👉 Résultat : 42 (typeof parsedInt est number) | |
// 🔍 parseFloat() : Convertir une chaîne de caractères en un nombre à virgule flottante | |
const floatString: string = '3.14'; | |
const parsedFloat: number = parseFloat(floatString); |
OlderNewer