Questions tagged [val]
26 questions
0
votes
0 answers
Val and Overrides in Scala
As i understand vals are immutable in Scala. However in case of inheritance we can override a val defined in the base class. If the val member already got created when the base class was constructed then how can derived class override it? What am i…

Player
- 378
- 2
- 7
0
votes
1 answer
Kotlin. How to reset each array element to zero?
I'm using FloatArray:
private val values = FloatArray(5)
At some point, I need to reset each array value to zero. I tried doing it like this:
values.onEachIndexed { index, value -> value[index] = 0.0f }
But I am getting this error
No set…

testivanivan
- 967
- 13
- 36
0
votes
0 answers
JS: How can I get a random Key or Value of a object / dictionary / JSON in JavaScript?
So...basically I wanted to program a vocabulary trainer.
I stored all words in a dictionary (and don't spam the comments with "This is not a JSON", i know),
the key was the English word, the value was the German/French word.
I wanted that in the…

Google Donut
- 21
- 5
0
votes
3 answers
How to get the input field Value and put it in a paragraph?
I want to get the value of an input field and put the value in between a paragraph and a tag.
$(document).ready() {
$("#submit").on("click", function() {
let inputval = $("#name").val();
$(".inputvalue").val(inputval);
…

silence1979g
- 11
- 1
0
votes
1 answer
Kotlin Var and Val Getter and Setter Problem
I am new to Kotlin Programming Language. (Java -> Kotlin)
var x
get()= 4; // Showing error Property must be initialized
val y
get()= 4; // No error
Why is this happening ?

Jithin Murali
- 33
- 6
0
votes
1 answer
How can I handle eval() exec() multiline as first in first out
I have code from this Question: Why is Python's eval() rejecting this multiline string, and how can I fix it?
def multiline_eval(expr, context={}):
"Evaluate several lines of input, returning the result of the last line"
tree =…

Hunt3r
- 3
- 2
0
votes
0 answers
Kotlin: mark function argument after sanitizing it into a new variable as "do not use this anymore"
To start: this question is already kind of resolved for me. But the discussion might be interesting.
I like code so let's look at this function:
fun foo(path: Path) {
val absPath = path.normalize().absolute() // sanitizing
…

Stefan
- 1
- 1
0
votes
3 answers
I have list in kotlin and if else must should distribute them into categories
sorry for my English, but I have a problem. I have a list of animals, and the "if else" construct should divide the animals into categories and output the correct category to the correct question.
Thank you in advance
fun main() {
val…

Valik
- 1
0
votes
1 answer
JQuery: dynamically retrieve value from autoNumeric
I have a group of textbox on which I configured an autoNumeric (this plugin: https://github.com/autoNumeric/autoNumeric ):
$("input[name$='something']").autoNumeric('init', {aSep: '.', aDec: ',', aSign: ' €', vMax: '99999999999.9999'});
When I post…

Stefano Vercellino
- 353
- 1
- 6
- 17
-1
votes
1 answer
the "Error: reassignment to val"be thrown in function
when I run the following codes, the "error: reassignment to val" be thrown, anyone knows why?
def main(args: Array[String]) :Unit = {
var a = 10
def Fun(a:Int):Unit = {
while( a < 20 ){
println( "Value of a: " + a );
a =…

kiki Shao
- 19
- 3
-3
votes
1 answer
Academic project named molecule design
It is based on deep learning techniques.
Now I am dealing with the cnn model having 'Smiles' as an input. I had to encode it, but I always have an accuracy equal to 0. What should I do?
This is the algorithm I am talking about:
from keras.models…

Abir b
- 11
- 1