Selected list item attempt to get item 2 of a list of length 1

i am trying to solve from 3 days it was not solved please help

Your list only has one element, you’re trying to get a second element from the list.

how to solve gave me hint little bit more

i had tried 1 also still error

An array in Java starts at 0, put 0.

1 Like

What is the content that has odd?

Try with odd.text instead of global variable.

Why you are using set amount to 0? When you multiply rough to amount 0 its gives result 0 , And also, set odd veriable text when text changes not in initialize like you did, that time maybe odd text is also zero , and you can’t split text 0 and get There index 2,

@kingbhishma9
There is no need of select list item block and other things connected to it. Instead directly use the odd.Text block with set raugh.Text block

Below is the image of what I am talking about, to understand it better

Hope it helps :+1:

If we go from your previous thread where you wanted to split after decimal

How to make a procedure Procedures - Kodular Docs

/Boban

2 Likes

Btw, you just need this one

/Boban

It is saying you trying to get index 2 of list why just has index 1 for more clearly if you just need global odd at split text then you can directly use odd.text block
Reason: you initialise it with odd.text but on screen initialise odd.text is empty
Solution:in odd.textchanged set global odd to odd.text

But if you know his previous thread you will understand what it is about

/Boban

Yes I know but he can use odd.text instead of global odd I think it will help him
I think it is because a global variable made when screen initialise and when screen initialise the odd.text will be empty
Tell me if I am wrong

We have no way of knowing (what/when or get/set) he is using that global for, but since he tried with 1

and by doing split att dot (decimal) on single value would produce that error when he select index 2, hence my suggestion

/Boban

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.