Pamasich

@Pamasich@lemm.ee

This profile is from a federated server and may be incomplete. Browse more on the original instance.

Pamasich,

Huh, why isn’t this one federating over to either kbin.social or kbin.earth, has lemm.ee defederated from kbin?

Pamasich,

Testing how long a comment takes to federate

Pamasich,

Can I federate it to a new instance by commenting again?

Pamasich, (edited )

General


<span style="color:#323232;">Test test
</span><span style="color:#323232;">test test
</span>

<span style="color:#323232;">also testing if two code blocks in the same comment work
</span>

<span style="color:#323232;">what about an intentional end tag
</span><span style="color:#323232;"></span>
</span>

<span style="color:#323232;"><span style="color:#000000">some intentional code</span>
</span>
Pamasich,

Rust

(example provided by Edge Copilot)


<span style="font-style:italic;color:#969896;">// A generic function to swap two values of any type that implements Copy
</span><span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">swap</span><span style="color:#323232;"><T: Copy>(x: </span><span style="font-weight:bold;color:#a71d5d;">&mut</span><span style="color:#323232;"> T, y: </span><span style="font-weight:bold;color:#a71d5d;">&mut</span><span style="color:#323232;"> T) {
</span><span style="color:#323232;">    </span><span style="font-style:italic;color:#969896;">// Use a temporary variable to store the value of x
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> temp </span><span style="font-weight:bold;color:#a71d5d;">= *</span><span style="color:#323232;">x;
</span><span style="color:#323232;">    </span><span style="font-style:italic;color:#969896;">// Assign the value of y to x
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;">x </span><span style="font-weight:bold;color:#a71d5d;">= *</span><span style="color:#323232;">y;
</span><span style="color:#323232;">    </span><span style="font-style:italic;color:#969896;">// Assign the value of temp to y
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;">y </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> temp;
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">main</span><span style="color:#323232;">() {
</span><span style="color:#323232;">    </span><span style="font-style:italic;color:#969896;">// Test the swap function with different types
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let mut</span><span style="color:#323232;"> a </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">10</span><span style="color:#323232;">;
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let mut</span><span style="color:#323232;"> b </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">20</span><span style="color:#323232;">;
</span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"Before swap: a = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">, b = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">"</span><span style="color:#323232;">, a, b);
</span><span style="color:#323232;">    </span><span style="color:#62a35c;">swap</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">&mut</span><span style="color:#323232;"> a, </span><span style="font-weight:bold;color:#a71d5d;">&mut</span><span style="color:#323232;"> b);
</span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"After swap: a = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">, b = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">"</span><span style="color:#323232;">, a, b);
</span><span style="color:#323232;">
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let mut</span><span style="color:#323232;"> c </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"Hello"</span><span style="color:#323232;">;
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let mut</span><span style="color:#323232;"> d </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"World"</span><span style="color:#323232;">;
</span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"Before swap: c = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">, d = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">"</span><span style="color:#323232;">, c, d);
</span><span style="color:#323232;">    </span><span style="color:#62a35c;">swap</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">&mut</span><span style="color:#323232;"> c, </span><span style="font-weight:bold;color:#a71d5d;">&mut</span><span style="color:#323232;"> d);
</span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"After swap: c = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">, d = </span><span style="color:#0086b3;">{}</span><span style="color:#183691;">"</span><span style="color:#323232;">, c, d);
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span>
Pamasich,

Java

(example provided by Edge Copilot)


<span style="color:#323232;">// A generic class to store a pair of values of any type that implements Comparable
</span><span style="color:#323232;">public class Pair<T extends Comparable<T>> {
</span><span style="color:#323232;">    // Declare two private fields of type T
</span><span style="color:#323232;">    private T first;
</span><span style="color:#323232;">    private T second;
</span><span style="color:#323232;">
</span><span style="color:#323232;">    // Define a constructor that takes two arguments of type T
</span><span style="color:#323232;">    public Pair(T first, T second) {
</span><span style="color:#323232;">        // Assign the arguments to the fields
</span><span style="color:#323232;">        this.first = first;
</span><span style="color:#323232;">        this.second = second;
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    // Define a getter method for the first field
</span><span style="color:#323232;">    public T getFirst() {
</span><span style="color:#323232;">        return first;
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    // Define a getter method for the second field
</span><span style="color:#323232;">    public T getSecond() {
</span><span style="color:#323232;">        return second;
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    // Define a method to compare the two values and return the larger one
</span><span style="color:#323232;">    public T max() {
</span><span style="color:#323232;">        // Use the compareTo method of the Comparable interface
</span><span style="color:#323232;">        if (first.compareTo(second) > 0) {
</span><span style="color:#323232;">            return first;
</span><span style="color:#323232;">        } else {
</span><span style="color:#323232;">            return second;
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    // Define a method to compare the two values and return the smaller one
</span><span style="color:#323232;">    public T min() {
</span><span style="color:#323232;">        // Use the compareTo method of the Comparable interface
</span><span style="color:#323232;">        if (first.compareTo(second) < 0) {
</span><span style="color:#323232;">            return first;
</span><span style="color:#323232;">        } else {
</span><span style="color:#323232;">            return second;
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    // Define a method to return a string representation of the pair
</span><span style="color:#323232;">    public String toString() {
</span><span style="color:#323232;">        return "(" + first + ", " + second + ")";
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">public class Main {
</span><span style="color:#323232;">    // Test the Pair class with different types
</span><span style="color:#323232;">    public static void main(String[] args) {
</span><span style="color:#323232;">        // Create a pair of integers
</span><span style="color:#323232;">        Pair<Integer> p1 = new Pair<>(10, 20);
</span><span style="color:#323232;">        System.out.println("p1 = " + p1);
</span><span style="color:#323232;">        System.out.println("The larger value of p1 is " + p1.max());
</span><span style="color:#323232;">        System.out.println("The smaller value of p1 is " + p1.min());
</span><span style="color:#323232;">
</span><span style="color:#323232;">        // Create a pair of strings
</span><span style="color:#323232;">        Pair<String> p2 = new Pair<>("Hello", "World");
</span><span style="color:#323232;">        System.out.println("p2 = " + p2);
</span><span style="color:#323232;">        System.out.println("The larger value of p2 is " + p2.max());
</span><span style="color:#323232;">        System.out.println("The smaller value of p2 is " + p2.min());
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span>

(example provided by Edge Copilot)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • ethstaker
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • khanakhh
  • JUstTest
  • InstantRegret
  • GTA5RPClips
  • Durango
  • normalnudes
  • cubers
  • tacticalgear
  • cisconetworking
  • tester
  • modclub
  • provamag3
  • anitta
  • Leos
  • lostlight
  • All magazines