Skip to content

Instantly share code, notes, and snippets.

View sevperez's full-sized avatar

Severin Perez sevperez

View GitHub Profile
class SpaceStation
attr_reader :sensors, :supply_hold, :fuel_tank, :thrusters
def initialize
@supply_hold = SupplyHold.new
@sensors = Sensors.new
@fuel_tank = FuelTank.new
@thrusters = Thrusters.new(@fuel_tank)
end
end
class SpaceStation
def initialize
@supplies = {}
@fuel = 0
end
def run_sensors
puts "----- Sensor Action -----"
puts "Running sensors!"
end
using System;
public class Program
{
public static void Main()
{
NobleGas argon = new NobleGas("Argon", "Ar", 18);
argon.Describe();
}
class Element
attr_accessor :name, :symbol, :number
def initialize(name, symbol, number)
self.name = name
self.symbol = symbol
self.number = number
end
def describe
using System;
public class Program
{
public static void Main()
{
Element hydrogen = new Element("Hydrogen", "H", 1);
hydrogen.Describe();
}
class Element
attr_accessor :name, :symbol, :number
def initialize(name, symbol, number)
self.name = name
self.symbol = symbol
self.number = number
end
def describe
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
List<String> particles = new List<String>();
particles.Add("electron");
particles.Add("proton");
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
string[] particles = new string[] { "electron", "proton", "neturon", null, null };
particles.SetValue("muon", 3);
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
string[] particles = new string[] { "electron", "proton", "neturon" };
particles.SetValue("muon", 3);
particles = ["electron", "proton", "neturon"]
particles.push("muon")
particles.push("photon")
particles.each do |particle|
puts particle
end