Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-7-sonnet-20250219-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

wgsl select

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-pro’s answer.
  1. User

    wgsl select

  2. Claude Assistant

    WGSL's select function provides conditional selection between two values based on a condition. It works similar to a ternary operator in other languages but with a different parameter order:

    select(falseValue, trueValue, condition)
    

    Examples:

    // Basic scalar selection
    let x = select(5, 10, true);  // Returns 10
    let y = select(5, 10, false); // Returns 5
    
    // Vector selection with scalar condition
    let vec_a = select(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), true);
    // Returns vec3(4.0, 5.0, 6.0)
    
    // Component-wise selection with boolean vector
    let condition = vec3(true, false, true);
    let result = select(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), condition);
    // Returns vec3(4.0, 2.0, 6.0)
    

    Would you like me to explain or break down this code further?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.