Skip to content

Instantly share code, notes, and snippets.

$name = "Harvey Specter"
$aNumber = 42
echo "Hello $name, your number is $aNumber"
$myValue = 12
$myValue.GetType()
$myValue = "Hello"
$myValue.GetType()
[int]$i = 12
$i.GetType()
$i = "Hello"
$i.GetType()
$name = "Harvey Specter"
$aNumber = 42
echo "Hello $name, your number is $aNumber and this guy never was here $neverDefined"
using System;
using System.Text;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
StringBuilder messageOfTheDay = new StringBuilder();
$currentDate = Get-Date
$messageOfTheDay = ""
if($currentDate.Day % 2 -ne 0)
{
$messageOfTheDay = "Today is an odd Day, "
}
else
{
$messageOfTheDay = "Today all should be even, "
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
while (new Random().Next(0, 50) > 50)
{
while((Get-Random -Minimum 1 -Maximum 100) -gt 50)
{
Write-Host "While... Random seems to be bellow 50."
}
Do
{
Write-Host "Do While... Random seems to be bellow 50."
} while((Get-Random -Minimum 1 -Maximum 100) -gt 50)
$items | Write-Host
$items | foreach { Write-Host "$_ has a length of" $_.Length }