- Home /
How can you do calculations on two lists?
I have two lists of floats and I want to be able to divide the contents of both lists together:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class moveCube : MonoBehaviour {
public List myListPerson = new List();
public List<float> myListCar = new List<float>();
}
I am adding new floats to this list in Update using myListPerson.Add and I want to be able to do calculations on these lists in real time e.g. mylistPerson/myListCar.
Is this possible? Sorry if this question is very vague.
Good day. I edited your question... USE THE CODE BUTTON TO PASTE CODE PLEASE!
Answer by tormentoarmagedoom · Oct 03, 2018 at 04:16 PM
Good day.
Yes is very vague.. You ask
"Is this possible?"
I answer you:
Yes, it is.
Good bye
I supose you want to know how to do it (you didnt ask for it....) You want to know something very simple, i dont understand why are you asking this.... If you are able to create and declare a List, really don't know how to access it? its very strange... You spent 0 minutes on goolge looking for it... So i dont think is good for you to give you the answer...
Second, wtf means
"mylistPerson/myListCar"
divide a list with another list? only numbers can be divided by other numbers... Maybe you want to say something like this...?
float result = mylistPerson[i]/myListCar[u];
Please remake all whole question, using good examples, explaingin why you need this, what you find on internet, what YOU TRIED...
Now yes. Good bye.