Skip to main content
0votes
2answers
77views

Comparing an array element to a value throws an error

I'm not sure what I am doing wrong, but when I execute the code below: func twoSum(_ nums: [Int], _ target: Int) -> [Int] { let length = nums.count-1; for index1 in 0...length { ...
ATL_DEV's user avatar
  • 9,623
1vote
3answers
92views

Function to evaluate vector based on time and stops once it reaches a threshold

I have a data frame with three variables ID, year and value. I would like to know how many times the "value" has been larger than a threshold going backwards, from the most recent year to ...
user30335471's user avatar
0votes
1answer
32views

How to show a plot only in HTML output in quarto

I wanted to have a dynamic .qmd report which included some mapview plots, but the code would not compile if NOT in HTML format, because it would complain about code generating HTML code for non HTML ...
Tiago Marques's user avatar
1vote
1answer
24views

Can you create multiple columns based on the same set of conditions in Polars?

Is it possible to do something like this in Polars? Like do you need a separate when.then.otherwise for each of the 4 new varialbles, or can you use struct to create multiple new variables from one ...
catquas's user avatar
0votes
0answers
78views

Tailwind default styling not being applied when using a custom 'cn' util function with tailwind-merge and clsx

I am using Tailwind V4 and created a custom utility function: import type { ClassValue } from 'clsx'; import { clsx } from 'clsx'; import { twMerge } from 'tailwind-merge'; export const cn = (......
meez's user avatar
  • 4,828
0votes
1answer
88views

How can I define an infinite loop condition in the for loop in java?

I was making a program in which user can keep entering numbers till user enters a multiple of 10. So I wanted to created a for loop for that and didn't knew what should be the infinite loop condition ...
Sanskar Kumar's user avatar
0votes
1answer
37views

How to override styling when both conditions are true with Tailwind css

In my Astro component I am using class:list for my tailwind styling. I have the following situation where both conditions are true, I want isRedColor to be leading. How can I fix that? <span ...
meez's user avatar
  • 4,828
0votes
5answers
146views

If statement vs. function pointer (performance)

Consider the following: while(running) { if(logMode == true) log(); bar(); } VS if (logMode == true) func_ptr = log; else func_ptr = noop; //noop is empty function that ...
Alex Mungan's user avatar
1vote
2answers
94views

Dynamically updating and doing math on arrays in Excel

I am dynamically populating an array in Excel from another array in a different sheet based on a criteria and was successful in that but now I wish to auto update the returned total based on another ...
Jonathan Marshall's user avatar
-3votes
0answers
28views

Why does this not work in JS? It always returns Good morning to the console [duplicate]

I am trying to make make it so that it logs 'Good morning!' in the console if the variable hour is between 6 and 12 and 'Good afternoon!' if it is between 13 and 17 and then 'Good night!' if it doesn'...
Mark's user avatar
0votes
0answers
36views

SAS if-then Statement to Python Vectorized Approach - My Values are Not Matching Up

I am trying to replicate some values in a dataset. The original data that I am running my code against for verification purposes has two categories across multiple groups, like so: grp5 0 ...
GSA's user avatar
  • 813
1vote
1answer
18views

spss conditional based on macro text

I'm trying to build a simple variable in spss like below but can't figure it out from documentation. In sas, you simply need to put qoutes around your macro to resolve. Can't figure out how in SPSS. ...
Mark Hedman's user avatar
1vote
1answer
54views

Swift custom struct: string interpolation not picking up custom description

In the following Swift code: import Foundation struct MySet<T: Hashable>: CustomStringConvertible { let set: Set<T> } extension MySet { var description: String { return &...
Rick Clark's user avatar
0votes
1answer
78views

RangeError (length): Invalid value: Not in inclusive range 0..5: 6

I am working in quiz app i want when user select answers of all question it should render result screen, it render all question and one can select answers well but after last question instead of ...
Shadrack Sylvestar Mbwagha's user avatar
-2votes
2answers
86views

What is better: x == False or not x? [duplicate]

There are two different ways to check for a negative condition in python: if not x: and if x == False: Which is best by standarts of clear code/faster? I saw people using both, but which of this ...
Paul D's user avatar

153050per page
close